From 1e3e58bb45b3597531b2fe81937a90219fbaaf34 Mon Sep 17 00:00:00 2001 From: Trung Dang Date: Thu, 4 Jul 2024 12:54:49 +0700 Subject: [PATCH] fix(aws-lambda): set cookies with comma is bugged (#3084) * fix(aws-lambda): setting cookies with comma is bugged * style: apply lint & format fixes --- src/adapter/aws-lambda/handler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/adapter/aws-lambda/handler.ts b/src/adapter/aws-lambda/handler.ts index 4a5cfdad..634545e4 100644 --- a/src/adapter/aws-lambda/handler.ts +++ b/src/adapter/aws-lambda/handler.ts @@ -258,7 +258,12 @@ abstract class EventProcessor { 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')