From eb79aa9806ed9c45cf8657e79b6aca990efa8c0c Mon Sep 17 00:00:00 2001 From: NamesMT Date: Wed, 3 Jul 2024 14:02:16 +0000 Subject: [PATCH] fix: set cookies with comma is bugged --- src/request.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/request.ts b/src/request.ts index 2d370ac..1ec2eab 100644 --- a/src/request.ts +++ b/src/request.ts @@ -84,7 +84,10 @@ abstract class RequestEventProcessor implements Ev setCookies(event: E, res: Response, result: LambdaHandlerResult) { 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')