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 empty response to default to 204 #2845

Closed
hueniverse opened this issue Oct 15, 2015 · 6 comments
Closed

Allow empty response to default to 204 #2845

hueniverse opened this issue Oct 15, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Oct 15, 2015

No description provided.

@kanongil
Copy link
Contributor

@kanongil kanongil commented Oct 15, 2015

What changed since #1470?

@hueniverse
Copy link
Contributor Author

@hueniverse hueniverse commented Oct 15, 2015

I'm seeing cases where a 200 with no payload is getting browsers stuck or error out. I found myself sending useless responses just to avoid these errors so it looks like browsers now prefer a 204 over 200 (or even expect it).

@kanongil
Copy link
Contributor

@kanongil kanongil commented Oct 15, 2015

Are you sure it is not due to a missing content-type header for those responses?

200 responses has a payload by definition, and I'd guess that browsers can get confused about this.

I'd probably change the semantics of the reply argument, so that reply() signals the no payload case (using code 204), while reply('') signals that there is a zero-length payload, adding the default content-type for string response.

@hueniverse
Copy link
Contributor Author

@hueniverse hueniverse commented Oct 15, 2015

That's a good idea. We already set content-length to zero.

@hueniverse hueniverse added this to the 11.0.0 milestone Oct 16, 2015
@hueniverse hueniverse changed the title Empty response should default to 204 Allow empty response to default to 204 Oct 16, 2015
@gergoerdosi
Copy link
Contributor

@gergoerdosi gergoerdosi commented Oct 16, 2015

Why 200 is the default? Just to not introduce a breaking change?

@hueniverse
Copy link
Contributor Author

@hueniverse hueniverse commented Oct 16, 2015

Because too many clients hard code 200 as success.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants