Skip to content

Conversation

@vixalien
Copy link
Contributor

@vixalien vixalien commented May 1, 2025

Fix #13723

Changes

  • When a middleware called next(url) and subsequent code changed cookies, those cookies would not be saved
  • This is because previously, when a rewrite happened, a new AstroCookies instance was setup, but when rendering the response, it used the previous cookies value.

Testing

  • I added a testcase

Docs

/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented May 1, 2025

🦋 Changeset detected

Latest commit: 7b923fa

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 May 1, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented May 1, 2025

CodSpeed Performance Report

Merging #13740 will not alter performance

Comparing vixalien:wip/vixalien/cookies-next-rewrite (7b923fa) with main (28f8716)

Summary

✅ 6 untouched benchmarks

@vixalien vixalien force-pushed the wip/vixalien/cookies-next-rewrite branch from 1c1367c to 7b923fa Compare May 2, 2025 11:20
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.

Thank you!

@ematipico ematipico merged commit 6935540 into withastro:main May 2, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request May 2, 2025
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
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.

rewrites with next() in middleware do not save the cookies

2 participants