0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

fix(aws-lambda): set cookies with comma is bugged (#3084)

* fix(aws-lambda): setting cookies with comma is bugged

* style: apply lint & format fixes
This commit is contained in:
Trung Dang 2024-07-04 12:54:49 +07:00 committed by GitHub
parent 75c314c279
commit 1e3e58bb45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -258,7 +258,12 @@ abstract class EventProcessor<E extends LambdaEvent> {
setCookies(event: E, res: Response, result: APIGatewayProxyResult) {
if (res.headers.has('set-cookie')) {
const cookies = res.headers.get('set-cookie')?.split(', ')
const cookies = res.headers.getSetCookie
? res.headers.getSetCookie()
: Array.from(res.headers.entries())
.filter(([k]) => k === 'set-cookie')
.map(([, v]) => v)
if (Array.isArray(cookies)) {
this.setCookiesToResult(event, result, cookies)
res.headers.delete('set-cookie')