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
Calling cookies.set twice sets only one value #283
Comments
im seeing the same problem on NextJS
from the spec:
comma is used in the Expires attribute value |
I'm not seeing this issue at Next.js v13.4.10: import { NextResponse } from 'next/server'
export const config = { runtime: 'edge' }
export default req => {
const response = new NextResponse()
response.cookies
.set('cookie1', 'cookie1')
.set('cookie2', 'cookie2')
return response
} That produces the following headers: $ curl -i http://localhost:3000/api
HTTP/1.1 200 OK
set-cookie: cookie1=cookie1; Path=/
set-cookie: cookie2=cookie2; Path=/
date: Mon, 17 Jul 2023 15:49:55 GMT
connection: close
transfer-encoding: chunked Closing for now; Happy to reopen if you can provide a reproducing of the issue using the latest version 🙂 |
Bug Report
Current behavior
Calling "cookies.set" twice on an appdir api route will set only one cookie.
Expected behavior/code
You'll see one "Set-Cookie" with 2 values, however it should be instead 2 "Set-Cookie" with only one value.
Set-Cookie can be repeated as many time as needed in an HTTP response to set multiple cookies.
Possible solution
This comment explains that
.append()
shouldn't be used in response-cookies.tsAdditional context/screenshots
I opened this issue in Next.js, it has been closed but I see that the file wasn't modifier in the edge-runtime source code so I think it's better to open it here !
The text was updated successfully, but these errors were encountered: