aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-03-20 12:07:24 -0400
committerAdnan Maolood <[email protected]>2021-03-20 12:07:24 -0400
commite5c0afa013a85e0546492cd2030b892ab3883927 (patch)
tree6d1bf13faa3c238c6561ca8fcede6247af112a4f
parentRemove unused field (diff)
downloadgo-gemini-e5c0afa013a85e0546492cd2030b892ab3883927.tar.xz
go-gemini-e5c0afa013a85e0546492cd2030b892ab3883927.zip
response: Treat empty meta as invalid
-rw-r--r--response.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/response.go b/response.go
index 7404082..03d65ef 100644
--- a/response.go
+++ b/response.go
@@ -72,13 +72,9 @@ func ReadResponse(r io.ReadCloser) (*Response, error) {
// Trim carriage return
meta = meta[:len(meta)-1]
// Ensure meta is less than or equal to 1024 bytes
- if len(meta) > 1024 {
+ if len(meta) == 0 || len(meta) > 1024 {
return nil, ErrInvalidResponse
}
- if resp.Status.Class() == StatusSuccess && meta == "" {
- // Use default media type
- meta = defaultMediaType
- }
resp.Meta = meta
// Read terminating newline