Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Content-Length: 0 request header for empty POST etc. #120

Merged
merged 1 commit into from
Dec 17, 2018

Conversation

clue
Copy link
Owner

@clue clue commented Dec 16, 2018

Add documentation for when this library will automatically add an
outgoing Content-Length request header and that this header should
only be passed manually for request streaming.

Additionally, we now make sure to include a Content-Length: 0 request
header if the request body is known to be empty and the request method
usually expects a request body (only applies to POST, PUT and
PATCH). While not strictly required by the newer RFC 7230, this does
improve compatibility with some HTTP servers which seem to follow the
older RFC 2616 semantics.

Resolves / closes #117

Add documentation for when this library will automatically add an
outgoing `Content-Length` request header and that this header should
only be passed manually for request streaming.

Additionally, we now make sure to include a `Content-Length: 0` request
header if the request body is known to be empty and the request method
usually expects a request body (only applies to `POST`, `PUT` and
`PATCH`). While not strictly required by the newer RFC 7230, this does
improve compatibility with some HTTP servers which seem to follow the
older RFC 2616 semantics.
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed changes work for me. 👍

@clue clue merged commit 26797c6 into clue:master Dec 17, 2018
@clue clue deleted the empty-request branch December 17, 2018 11:13
@clue
Copy link
Owner Author

clue commented Dec 17, 2018

@CharlotteDunois Thank you for confirming, I believe this to be fixed now :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty body on POST request not compatible with some legacy servers (411 Length Required)
1 participant