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

Allow no body when Content-Length = 0 #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Allow no body when Content-Length = 0 #85

wants to merge 2 commits into from

Conversation

lhigueragamboa
Copy link

The HTTP spec is ambiguous in determining if a request could have no body when the method is POST, PUT, or PATCH. Some popular HTTP server, like nginx, adopt the policy that a request of the aforementioned methods with no body is allowed if and only if it has the header Content-Length set to 0.

It makes sense not to try to marshal the body when Content-Length has that value.

I understand that an empty body is not the same as no body, and this is why I said the spec is ambiguous. Even though a request of such methods with no body might be unRESTful it is useful for implementing "actions".

Would you consider merging this?

Regards,
Alfonso.

@lhigueragamboa lhigueragamboa changed the title Allow no body when Content-Type = 0 Allow no body when Content-Length = 0 Jan 27, 2015
@pjvds
Copy link

pjvds commented Dec 17, 2015

Is there any reason this is not merged?

@mihasya
Copy link
Collaborator

mihasya commented Dec 17, 2015

I don't have too strong an opinion, but if that matches nginx's behavior, we can probably merge it without too much fuss. We've definitely worked around this issue at Opsmatic by passing a {} body, so I'm sympathetic to it.

@rcrowley @wadey any strong thoughts on this?

Also, rebase would be much appreciated so that the merge can be done automatically /cc @lhigueragamboa

@willfaught
Copy link
Contributor

I would find this useful as well.

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.

None yet

4 participants