Flatten request body to prevent hackney adding unnecessary headers #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5.
Hackney sees a body of
<<>>
as empty and doesn't set any extra headers for it. But it sees[<<>>]
as a non-empty body that happens to have a length of zero, so it gets a content type ofapplication/octet-stream
and a content length of0
(edit: this is intended for POST/PUT requests only). This PR flattens the body into a single binary so that hackney can detect empty bodies correctly.Unfortunately this isn't practical to unit test, but I can confirm that it fixes the 500 errors I saw in #5.