Skip to content

Route.redirect: accept cookies and headers (#95) - #105

Draft
nounder wants to merge 2 commits into
mainfrom
cursor/fix-95-redirect-cookies-c215
Draft

Route.redirect: accept cookies and headers (#95)#105
nounder wants to merge 2 commits into
mainfrom
cursor/fix-95-redirect-cookies-c215

Conversation

@nounder

@nounder nounder commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Fixes #95

Summary

Route.redirect previously only set location (and optional status). Use cases that need set-cookie on redirects had to drop down to raw Entity.make.

Changes

  • Extend Route.redirect options with cookies?: Cookies.Cookies and headers?: Entity.Headers
  • Serialize cookies via Cookies.toSetCookieHeaders
  • Tests for single/multiple cookies, empty cookies, custom headers, and merge with wrapping layers

Test plan

  • bun test test/Route.test.tsx
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 12, 2026 00:47
Extend Route.redirect to accept a cookies option (Cookies.Cookies) and a
headers option, so redirects can carry a set-cookie header alongside the
Location header. Cookies are serialized with Cookies.toSetCookieHeaders and
merge with any set-cookie headers appended by wrapping route layers.

Fixes #95
Use the RouteSet-returning layer shape expected by Route.use, and adjust
the expected set-cookie order to match how Entity.merge appends the
wrapping layer's cookie after the inner route's.

Refs #95

Co-authored-by: Ralph Gutkowski <nounder@users.noreply.github.com>
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.

Route.redirect: accept cookies

2 participants