fix: update cookieJar methods to keep the name and params consistent - #8654
Merged
ZxBing0066 merged 3 commits intoApr 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR unifies cookieJar method naming and parameter usage to prevent errors when retrieving cookies by ensuring consistency across modules.
- Changed cookieJar calls in template tags to use getOrCreateForParentId with workspace._id
- Updated type definitions and method implementations in base-extension, base-extension-worker, and templating-worker-database
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/insomnia/src/ui/components/templating/local-template-tags.ts | Updated cookieJar calls to use getOrCreateForParentId with workspace._id |
| packages/insomnia/src/templating/types.ts | Modified cookieJar type to require a parentId parameter |
| packages/insomnia/src/templating/base-extension.ts | Refactored cookieJar method call to use getOrCreateForParentId |
| packages/insomnia/src/templating/base-extension-worker.ts | Updated cookieJar fetch call to use parentId in request body |
| packages/insomnia/src/main/templating-worker-database.ts | Adjusted lookup logic to expect getOrCreateForParentId with body.parentId |
ZxBing0066
marked this pull request as ready for review
April 28, 2025 10:01
ZxBing0066
enabled auto-merge (squash)
April 28, 2025 10:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
When using a template to get the cookie, it throws an error.
Root cause
There are two issues:
cookieJar.getOrCreateForParentId, but usegetOrCreateForWorkspaceintemplating-worker-database.tsto match the message.templating-worker-database.tsusesbody.idas the parent id, but the real param name used inbase-extension-worker.tsisbody.parentId.Changes
getOrCreateForWorkspacetogetOrCreateForParentIdto avoid similar issues.getOrCreateForParentIdparam from workspace to parentId to match the new name