Skip to content

Commit

Permalink
fix: set cookies with comma is bugged
Browse files Browse the repository at this point in the history
  • Loading branch information
NamesMT committed Jul 3, 2024
1 parent 315331c commit eb79aa9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ abstract class RequestEventProcessor<E extends LambdaRequestEvent> 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')
Expand Down

0 comments on commit eb79aa9

Please sign in to comment.