Skip to content

http.ResponseWriter.Write() writes headers. #275

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

Closed
wants to merge 1 commit into from

Conversation

AlekSi
Copy link
Contributor

@AlekSi AlekSi commented Nov 26, 2015

So should we.

Otherwise call to Write() followed by WriteHeader() will produce unexpected result.

@AlekSi
Copy link
Contributor Author

AlekSi commented Dec 2, 2015

@vishr poke

@vishr
Copy link
Member

vishr commented Dec 2, 2015

In what case I would call WriteHeader() after Write? For me this is a program error.

@AlekSi
Copy link
Contributor Author

AlekSi commented Dec 8, 2015

In what case I would call WriteHeader() after Write?

From middleware or error handler.
Consider this example: https://gist.github.com/AlekSi/5562d7eb06f4970161d1. Without my patch, error will be send mixed with data with HTTP code 200. With my patch error will be logged, but not send.

@AlekSi
Copy link
Contributor Author

AlekSi commented Jan 19, 2016

@vishr poke

@vishr vishr force-pushed the master branch 5 times, most recently from a4bdbc9 to 6f0a737 Compare March 17, 2016 04:30
@vishr vishr force-pushed the master branch 7 times, most recently from fc10f66 to 0172fe6 Compare April 7, 2016 03:10
@AlekSi
Copy link
Contributor Author

AlekSi commented Jun 3, 2016

@vishr May you please merge it to v1? We hit this issue quite often.

vishr added a commit that referenced this pull request Jun 3, 2016
Signed-off-by: Vishal Rana <vr@labstack.com>
vishr added a commit that referenced this pull request Jun 3, 2016
Signed-off-by: Vishal Rana <vr@labstack.com>
@vishr
Copy link
Member

vishr commented Jun 3, 2016

It is in.

@vishr vishr closed this Jun 3, 2016
@AlekSi
Copy link
Contributor Author

AlekSi commented Jun 3, 2016

Thanks. But you decided not to me merge unit test?

vishr added a commit that referenced this pull request Jun 3, 2016
Signed-off-by: Vishal Rana <vr@labstack.com>
@vishr
Copy link
Member

vishr commented Jun 3, 2016

Just included it.

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