response: Treat empty meta as invalid
This commit is contained in:
parent
4c7c200f92
commit
e5c0afa013
@ -72,13 +72,9 @@ func ReadResponse(r io.ReadCloser) (*Response, error) {
|
|||||||
// Trim carriage return
|
// Trim carriage return
|
||||||
meta = meta[:len(meta)-1]
|
meta = meta[:len(meta)-1]
|
||||||
// Ensure meta is less than or equal to 1024 bytes
|
// Ensure meta is less than or equal to 1024 bytes
|
||||||
if len(meta) > 1024 {
|
if len(meta) == 0 || len(meta) > 1024 {
|
||||||
return nil, ErrInvalidResponse
|
return nil, ErrInvalidResponse
|
||||||
}
|
}
|
||||||
if resp.Status.Class() == StatusSuccess && meta == "" {
|
|
||||||
// Use default media type
|
|
||||||
meta = defaultMediaType
|
|
||||||
}
|
|
||||||
resp.Meta = meta
|
resp.Meta = meta
|
||||||
|
|
||||||
// Read terminating newline
|
// Read terminating newline
|
||||||
|
Loading…
Reference in New Issue
Block a user