valyala / fasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
MIT License
21.94k stars 1.76k forks source link

Add a note to clarify header.Set behavior on cookies #1864

Closed sigmundxia closed 2 months ago

sigmundxia commented 2 months ago

Hi Developers,

As described in this issue, currently header.Set does not reset but adds cookies. This pull request attempts to fix this so that header.Set resets cookies instead of adding them.

Feel free to let me know if there are any further changes you would like me to make.

Best regards!

erikdubbelboer commented 2 months ago

This would be a backwards incompatible change for anyone using header.Set with Cookie. I don't think we should just change it because of that. I think a better solution would be to really make this clear in the documentation that you need to delete the 'Cookie' header before setting it if you don't want to add.

sigmundxia commented 2 months ago

Indeed, changing the behavior of this method may cause compatibility issues for downstream software. I will try to make direct improvements to gofiber downstream. So, should this pull request be closed? Or should I undo all changes here and add a note about cookies in the code comments?

erikdubbelboer commented 2 months ago

Yeah sorry lets change this pull to only add a note to the documentation to clarify this behavior. Thanks!

sigmundxia commented 2 months ago

Yeah sorry lets change this pull to only add a note to the documentation to clarify this behavior. Thanks!

No problem, I also think a change to the description would be ideal 😊 I've made the changes, let me know if there are any further changes needed!

erikdubbelboer commented 2 months ago

Thanks, it's good!