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

Ensure cookies are attached when middleware changes the Response #8612

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

matthewp
Copy link
Contributor

Changes

  • When middleware return new Response we need to attach cookies to it.
  • This aligns with how components work as well, if you return a new Response from a page component the cookies that have been set via Astro.cookies.set() go along for the ride.

Testing

New test case added

Docs

N/A, bug fix

@changeset-bot
Copy link

changeset-bot bot commented Sep 20, 2023

🦋 Changeset detected

Latest commit: 705c9f7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 20, 2023
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Now that I look at the fix, it seemed so simple 😢

Thank you for looking into it Matthew!

@matthewp matthewp force-pushed the cookies-new-response-middleware branch from f8886bc to 705c9f7 Compare September 21, 2023 12:38
@matthewp matthewp merged commit bcad715 into main Sep 21, 2023
@matthewp matthewp deleted the cookies-new-response-middleware branch September 21, 2023 12:55
@astrobot-houston astrobot-houston mentioned this pull request Sep 21, 2023
@le-u-f
Copy link

le-u-f commented Sep 21, 2023

You rock! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants