Skip to content

Always add Content-Length: 0 even for empty bodies - #917

Closed
onno-vos-dev wants to merge 1 commit into
benoitc:masterfrom
onno-vos-dev:always-add-content-length-even-for-0-sized-bodies
Closed

Always add Content-Length: 0 even for empty bodies#917
onno-vos-dev wants to merge 1 commit into
benoitc:masterfrom
onno-vos-dev:always-add-content-length-even-for-0-sized-bodies

Conversation

@onno-vos-dev

Copy link
Copy Markdown

I got a report on aws-beam/aws-elixir#238 that the upgrade I recently did to a later version of Hackney broke things for 0-sized bodies. AWS apparently requires a Content-Length being set even for 0-sized bodies.

Instead of implementing a fix on my end, I'm testing the waters to see how open you are to fixing this from within Hackney itself.

@benoitc

benoitc commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Thanks @onno-vos-dev for the report and for flagging the AWS regression (aws-beam/aws-elixir#238).

I picked this up in #925, done the curl way: an empty body gets Content-Length: 0 only for the body-bearing methods (POST/PUT/PATCH), and using a binary value so it stays type-correct. GET/HEAD/DELETE stay without it.

Closing in favor of #925, which covers your case.

@benoitc benoitc closed this Aug 11, 2026
@benoitc benoitc mentioned this pull request Aug 11, 2026
benoitc added a commit that referenced this pull request Aug 11, 2026
Bundles the fixes merged since 4.7.2 (#914/#915, #918/#919, #920, #921,
#922, #924) and the curl-style Content-Length change (#917/#925). Bumps
dependencies to their latest releases: quic 1.8.0, webtransport 0.4.4,
mimerl 1.5.0, cowboy 2.18.0 (test).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants