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 parse gzipped body #1458

Merged
merged 1 commit into from
Jul 30, 2021
Merged

🐛 fix parse gzipped body #1458

merged 1 commit into from
Jul 30, 2021

Conversation

faceair
Copy link
Contributor

@faceair faceair commented Jul 29, 2021

Now when we use filber.Ctx.BodyParser to deserialize JSON, it uses filber.Ctx.fasthttp.Request.Body method internally to take the raw body data, which works fine in most cases.

But when the request body is gzip-compressed, filber.Ctx.fasthttp.Request.Body takes the compressed data and there is no way to deserialize it directly.
image

So in this PR I changed the method inside filber.Ctx.BodyParser that takes the request body to filber.Ctx.Body method, which automatically detects the encoding of the request body and decompresses it itself. I have also added test cases for compression requests.

@welcome
Copy link

welcome bot commented Jul 29, 2021

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87
Copy link
Member

Thanks for the pull request, understand the code also, but not quite the description, can you adjust this again a bit, so that everyone knows what should be achieved with the pull request, if someone goes through the link in the release on the pull request

@faceair
Copy link
Contributor Author

faceair commented Jul 30, 2021

Thanks to review, I have added more complete description information.

@ReneWerner87 ReneWerner87 merged commit 1e0d4d3 into gofiber:master Jul 30, 2021
@welcome
Copy link

welcome bot commented Jul 30, 2021

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants