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
feature New functionality or improvement
Milestone

Comments

@hueniverse
Copy link
Contributor

No description provided.

@hueniverse hueniverse added bug Bug or defect breaking changes Change that can breaking existing code labels Oct 15, 2015
@hueniverse hueniverse self-assigned this Oct 15, 2015
@kanongil
Copy link
Contributor

What changed since #1470?

@hueniverse
Copy link
Contributor Author

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

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

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 added feature New functionality or improvement and removed breaking changes Change that can breaking existing code bug Bug or defect labels 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

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

@hueniverse
Copy link
Contributor Author

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
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants