-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What versions & operating system are you using?
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M2
Memory: 178.98 MB / 24.00 GB
Shell: 4.0.2 - /opt/homebrew/bin/fish
Binaries:
Node: 22.17.1 - ~/.local/state/fnm_multishells/13811_1754254652214/bin/node
npm: 10.9.2 - ~/.local/state/fnm_multishells/13811_1754254652214/bin/npm
bun: 1.2.19 - ~/.bun/bin/bun
npmPackages:
@cloudflare/vitest-pool-workers: ^0.8.59 => 0.8.59
Please provide a link to a minimal reproduction
https://github.com/jimmycallin/cloudflare-workers-vitest-redirect-issue
Describe the Bug
When testing Cloudflare Workers with Vitest, SELF.fetch automatically follows redirects but fails to carry cookies from the initial response to the redirected request. This breaks testing scenarios that depend on cookie-based session management across redirects.
The only workaround I've found is to use worker.fetch directly which does not follow redirects, and manually make the second redirect while carrying over the cookie header, but I haven't been able to to integrate this with D1 and use vi.mock() to mock modules at the same time. Please correct me if I'm wrong.
Please provide any relevant error logs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status