Skip to content

Commit 217a056

Browse files
committed
feat: add multiple set-cookie headers in middleware
1 parent 9bc82ed commit 217a056

File tree

1 file changed

+5
-5
lines changed
  • packages/runtime/src/templates/edge-shared

1 file changed

+5
-5
lines changed

packages/runtime/src/templates/edge-shared/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ export const addMiddlewareHeaders = async (
3131
// We need to await the response to get the origin headers, then we can add the ones from middleware.
3232
const res = await originResponse
3333
const response = new Response(res.body, res)
34-
const originCookies = response.headers.get('set-cookie')
3534
middlewareResponse.headers.forEach((value, key) => {
36-
response.headers.set(key, value)
37-
// Append origin cookies after middleware cookies
38-
if (key === 'set-cookie' && originCookies) {
39-
response.headers.append(key, originCookies)
35+
if (key === 'set-cookie') {
36+
response.headers.append(key, value)
37+
}
38+
else {
39+
response.headers.set(key, value)
4040
}
4141
})
4242
return response

0 commit comments

Comments
 (0)