CodeGenieApp / CodeGenieApp/serverless-express
[Bug] API Gateway v2 cookies response should be array
- Lingua principale
- JavaScript
- Stelle
- 5.3k
- Fork
- 676
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
According to API Gateway v2 payload 2.0 docs (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html) the 'cookies' should be array.
And below code is current handling logic for it.
https://github.com/vendia/serverless-express/blob/671f914429e9708bfb1ee6ba76b5947a917592df/src/event-sources/aws/api-gateway-v2.js#L65-L67
However, with the latest express (v4.17.1).
When user set cookie using `res.cookie(name, value)`, it set 'set-cookie' header as string at first time.
and convert it as array when using `res.cookie(name, value)` more than once.
So, we should insert Array check logic, and convert it to array when it is not.
Plus,
If we didn't delete 'set-cookie' header in response, API gateway send 'set-cookie' header twice.
So, for gateway v2 and payload 2.0 we should delete 'set-cookie' header field.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start in src/event-sources/aws/api-gateway-v2.js at the linked handling logic, and compare the response behavior when Express sets one cookie versus multiple cookies. Done means API Gateway v2 receives cookies as an array and the original set-cookie header is removed so it is not sent twice.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, express, javascript
- Ambito
- api, backend, cloud
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100