-
Notifications
You must be signed in to change notification settings - Fork 128
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
Fix issue on status code when writer flush #58
Conversation
272cc4c
to
8f89127
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😳 thanks!
This test case is currently failing but will be fixed in the following commit. The fix will not follow nytimes#58.
This fixes nytimes#58 and the failing test case from 23770e4. This prevents the underlying Flusher from writing the wrong status code or writing headers before Content-Encoding has been set.
Correct me if I'm wrong but this actually highlights another bug that is left unfixed. If I think a far better, and more logical, fix is making I'm able to confirm that this repo fails the expanded test linked above. |
@tmthrgd nice catch! mind making a PR with your changes? |
I don't really agree. If you intentionly If you |
@jprobinson I'll take a look tomorrow (it's 3am here, whoops 💤). @juliens The current behaviour causes gzip compressed data to be written without the @juliens @jprobinson I'll prepare a pull-request to fix the current behaviour (which I think will need to revert 0f67f3f), and if there is a desire to change the semantics of |
This fixes nytimes#58 and prevents the underlying Flusher from writing the wrong status code or writing headers before Content-Encoding has been set. This is cb0f3d94c6 with the test case taken from 574da8f22d.
This fixes nytimes#58 and prevents the underlying Flusher from writing the wrong status code or writing headers before Content-Encoding has been set. This is cb0f3d94c6 with the test case taken from 574da8f22d.
This fixes nytimes#58 and prevents the underlying Flusher from writing the wrong status code or writing headers before Content-Encoding has been set. This is cb0f3d94c6 with the test case taken from 574da8f22d.
This fixes #58 and prevents the underlying Flusher from writing the wrong status code or writing headers before Content-Encoding has been set. This is tmthrgd/gziphandler@cb0f3d94c6 with the test case taken from tmthrgd/gziphandler@574da8f22d.
In the stdlib, when we call
Flush
on a response writer, if the status code header was never wrote, it write a 200 status codeAs the
WriteHeader
is buffered inGzipWriter
, if we call Flush in the handler or in a previous middleware, the status code 200 is send even if we have callWriteHeader
before flushing.