Skip to content
Myr

fix(aws-lambda): handle multiple cookies in streaming responses (#2926)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix: handle multiple cookies in streaming responses This fix does address that cookies have to be handled specially in lambda responses. Fixes #2921 * test: check cookie handling

authored by Markus Wolf · committed by GitHub · parent 75663ff · Browse files · 4 files+135 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+135 added−2 removed

  • tests:+75 added−0 removed
  • other:+60 added−2 removed

4 files+135 added−2 removed

added:runtime_tests/lambda/stream-mock.ts+43 added
added:runtime_tests/lambda/stream.test.ts+75 added
modified:runtime_tests/lambda/vitest.config.ts+5 added-1 removed
modified:src/adapter/aws-lambda/handler.ts+12 added-1 removed
124 unmodified lines
125 requestContext,126 context,127 })128129 const headers: Record<string, string> = {}130 const cookies: string[] = []131 res.headers.forEach((value, name) => {132 if (name === 'set-cookie') {133 cookies.push(value)134 } else {135 headers[name] = value136 }137 })138139 // Check content type140 const httpResponseMetadata = {141 statusCode: res.status,132 headers: Object.fromEntries(res.headers.entries()),142 headers,143 cookies,144 }145146 // Update response stream147 // @ts-expect-error awslambda is not a standard API
340 unmodified lines