Skip to content
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

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

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/adapter/aws-lambda/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,21 @@
context,
})

const headers: Record<string, string> = {}
const cookies: string[] = []
res.headers.forEach((value, name) => {
if (name === 'set-cookie') {
cookies.push(value)

Check warning on line 133 in src/adapter/aws-lambda/handler.ts

View check run for this annotation

Codecov / codecov/patch

src/adapter/aws-lambda/handler.ts#L133

Added line #L133 was not covered by tests
} else {
headers[name] = value
}
})

// Check content type
const httpResponseMetadata = {
statusCode: res.status,
headers: Object.fromEntries(res.headers.entries()),
headers,
cookies,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// Update response stream
Expand Down