-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
Compression Middleware needs to check status code #382
Comments
@RXminuS good catch and thx for the report |
Status code apparently is important to determine whether the response data should be compressed. go-chi#382
@pkieltyka I posted a quick'n dirty fix :-) |
...mmm actually, there seems to be something else going on as well :-/ I need to investigate more |
AH! |
My best guess is because of the naming conflict (overloading the WriteHeader method)...similar to what they are discussing here https://stackoverflow.com/questions/38513779/extending-golangs-http-responsewriter-functionality-to-pre-post-process-respons |
Ohhh, this had me going chase my tail for days now! If this is any consolation, here's a minimal reproduction: https://gist.github.com/AdamHepner/03b9addac10c47534bd3392cb0e069e1 |
This issue will probably going to cause a lot of people a lot of pain if they upgrade to v4. Perhaps worth pointing out in the release notes until it's fixed? |
Agreed -- this completely breaks redirects if I load the compression middleware. |
Released in https://github.com/go-chi/chi/tree/v4.0.1. |
Right now the compression middleware compresses any response and subsequently writes a 200 status code. However if for instance a 400 is returned we want to not send a 200 status code down; other compression middlewares seem to not compress if this is the case.
The text was updated successfully, but these errors were encountered: