Is there an option for lenient parsing of responses? 'Content-length header received in a 204 response. (RFC7230 3.3.2)' #353
-
|
I've just encountered an issue while using the S3 delete object rest api provided by Tigris, it seems it returns a 204 response with a content-length header which gun doesn't like. {error,{stream_error,{stream_error,protocol_error,
'Content-length header received in a 204 response. (RFC7230 3.3.2)'}}}This seems to be consistent with the official AWS S3 documentation ( https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html#API_DeleteObject_Example_2 ). As a workaround I can pattern match on this specific error, though that seems a bit fragile. So I was wondering if there is an option which makes gun a bit more lenient with responses. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
It's not valid HTTP: https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6
Gun does not currently have an option for this. Gun is stricter here with HTTP/2+ as the check isn't performed with HTTP/1.1. Perhaps you can use HTTP/1.1 for this specific request for now. I guess that even if a content-length isn't allowed by HTTP, a content-length of zero is fairly harmless so introducing an option to relax those harmless checks could be a long term solution. |
Beta Was this translation helpful? Give feedback.
-
|
Opened #354 for a future relaxed mode. |
Beta Was this translation helpful? Give feedback.
It's not valid HTTP: https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6
Gun does not currently have an option for this. Gun is stricter here with HTTP/2+ as the check isn't performed with HTTP/1.1. Perhaps you can use HTTP/1.1 for this specific request for now.
I guess that even if a content-length isn't allowed by HTTP, a content-length of zero is fairly harmless so introducing an option to relax those harmless checks could be a long term solution.