How can Response not set cookies in responses? #2328
Answered
by
kettanaito
zwhitchcox
asked this question in
Q&A
|
From the docs:
I'm confused about how you supposedly can't add cookies to a response. new Response('hello world', {
headers: {
'Set-Cookie': 'x=1'
}
})Or is this just talking about in the browser? |
Answered by
kettanaito
Oct 27, 2024
Replies: 1 comment
|
Hi, @zwhitchcox. That comment references the forbidden cookie names as per the Fetch API spec, which includes the MSW provides a universal |
0 replies
Answer selected by
kettanaito
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @zwhitchcox. That comment references the forbidden cookie names as per the Fetch API spec, which includes the
Set-Cookie. That limitation applies everywhere you have a faithful Fetch API implementation. Server-side implementations ignore certain aspects of the spec so you can set the cookie header in Node.js.MSW provides a universal
HttpResponseclass that allows for theSet-Cookieheader anywhere.