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 withRequest behavior without session strategy #8318

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

acburdine
Copy link
Member

closes #8317

  • previously, if no session strategy was configured in the Keystone config, the withRequest function would return early without calling createContext. If sudo() was called on the returned context from withRequest, the context object returned from sudo would have the req/res objects present on the initial context object (i.e. the one prior to withRequest being called)
  • this change makes withRequest consistent with the other context 'change' functions (sudo/exitSudo/withSession)

closes keystonejs#8317
- previously, if no session strategy was configured in the Keystone config, the withRequest function would return early without calling `createContext`. If `sudo()` was called on the returned context from withRequest, the context object returned from sudo would have the req/res objects present on the initial context object (i.e. the one prior to withRequest being called)
- this change makes withRequest consistent with the other context 'change' functions (sudo/exitSudo/withSession)
@changeset-bot

This comment was marked as resolved.

@vercel
Copy link

vercel bot commented Feb 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
keystone-next-docs ⬜️ Ignored (Inspect) Feb 16, 2023 at 10:46PM (UTC)

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1a91670:

Sandbox Source
@keystone-6/sandbox Configuration

@acburdine
Copy link
Member Author

also, I tried finding a good place to add tests for this edge case but didn't see any obvious spots to put it 😬

If there's a "correct" place to write tests for this let me know and I'll gladly add them 😄

Copy link
Member

@dcousens dcousens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @acburdine! Nice find

@dcousens
Copy link
Member

Failing tests is unrelated, this looks good to go 👍

@dcousens dcousens merged commit af74a91 into keystonejs:main Feb 17, 2023
@acburdine acburdine deleted the fix/withRequest branch February 17, 2023 11:50
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.

Context withRequest edge case bug
2 participants