next-runtime icon indicating copy to clipboard operation
next-runtime copied to clipboard

Appending `set-cookie` header in middleware leads to duplicate header

Open serhalp opened this issue 1 year ago • 0 comments

When appending a set-cookie header, the server returns two copies of the header. e.g.

export async function middleware(request, ev) {
  const next = NextResponse.next()
  next.headers.append('set-cookie', 'bar=chocochip')
  return next
}

Leads to:

image

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: test/e2e/middleware-responses/test/index.test.ts reason: Appending set-cookie header in middleware leads to duplicate header

serhalp avatar Jun 13 '24 21:06 serhalp