hoppscotch / hoppscotch-extension

🧩 Browser extensions to provide more capabilities to https://hoppscotch.io
https://hoppscotch.io
MIT License
255 stars 99 forks source link

fix: client browser cookies being unnecessarily deleted #274

Open josssch opened 8 months ago

josssch commented 8 months ago

The Problem

This pull request aims to fix the issue that has been bugging me as a user of Hoppscotch for a while. The problem lied with how cookies were handled, where any cookie specified in the Hoppscotch request would be deleted from my browser after the request finished. I disagree with it working like that, as I believe the extension should leave my browser as untouched as possible.

This was especially a problem when developing and testing one of my backends before I knew this behavior existed, and has cost me more time than I'd like to admit trying to figure out why my session cookies were disappearing lol.

The Fix

This modifies the way cookies are handled by the removeRequestCookies, by instead modifying it so pre-request we remember the state of the cookies before we change them. This lets the removeRequestCookies go through all modified cookies and return them to their original state as best as it can.

Other Things

Note: I have never touched the Chrome Extensions API before so apologies in advance for any oversights. I have not tested for Firefox.