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: client browser cookies being unnecessarily deleted #274

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

josssch
Copy link

@josssch josssch commented Feb 29, 2024

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

  • Added a format script to package.json to better make use of prettier

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

If a user is debugging with hoppscotch using a cookie for authorization, and they have one with the same name set it would just disappear. This commit fixes that bug by trying to return the cookie back to their original state. It also passes `credentials: "omit"` to the actual fetch to prevent it from doing any of the cookie handling as well.
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

1 participant