Closed sigmundxia closed 20 hours ago
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
The changes introduce a modification to the HTTPMiddleware
function in the middleware/adaptor/adaptor.go
file to prevent cookie duplication by removing all cookies from the request header before processing. Additionally, a new test function, Test_HTTPMiddlewareWithCookies
, is added to verify the middleware's behavior when handling cookies, ensuring that the response correctly includes the expected cookies when a POST request is made. The test also covers scenarios for GET requests and POST requests without cookies.
Files | Change Summary |
---|---|
middleware/adaptor/adaptor.go | Added a line in HTTPMiddleware to remove all cookies from the request header before setting new headers. |
middleware/adaptor/adaptor_test.go | Introduced Test_HTTPMiddlewareWithCookies to test the middleware's handling of cookies, ensuring proper response with expected cookies for POST requests, and added test cases for GET and POST without cookies. |
Objective | Addressed | Explanation |
---|---|---|
Cookies should not be duplicated within the header. (#3089) | ✅ |
🐰 In the land of code so bright,
A middleware fix brings delight.
No more cookies stacked in a row,
Just clean headers, watch them flow!
With tests in place, all's well and right,
Hopping along, we code through the night! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 80.09%. Comparing base (
44cd700
) to head (e297625
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@ReneWerner87 This is good to merge.
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
Description
In
adapter.go
, add a step to clear existing cookies before introducing new ones in theHTTPMiddleware
section, so that cookies are not duplicated after passing through the middleware.Fixes #3089
Type of change
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md