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

Fix bug that Content-Encoding won't be written to final response header for gzip and deflate #1

Merged
merged 2 commits into from
Jun 23, 2023

Conversation

lf4096
Copy link

@lf4096 lf4096 commented Apr 21, 2023

For gzip and deflate, gin.ResponseWriter.Write() will be called before ResponseWriter.Header().Set(). In this case, the ResponseWriter.Write() will call ResponseWriter.WriteHeaderNow(), and write the header to final response without encoding related headers. In this fix, ResponseWriter.Header().Set() was moved to before any call to gin.ResponseWriter.Write().

@aurowora aurowora merged commit aa5cc18 into aurowora:main Jun 23, 2023
@lf4096
Copy link
Author

lf4096 commented Jun 23, 2023

Sorry, this MR includes the module name changes. You may need to cherry pick the second commit only for the fix.

@VaiTon VaiTon mentioned this pull request Jul 17, 2023
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.

None yet

2 participants