-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Cookies before sending to AWS Runtine Interface #11
Conversation
Co-authored-by: Denis Alustau <denisalustau@gmail.com>
This isn't ready yet. Although it fixes the issue on the ExpressJS side, the way the cookies arrive on Bref breaks at https://github.com/brefphp/bref/blob/master/src/Event/Http/HttpRequestEvent.php#L192-L195 so it's likely we're not being compatible with API Gateway V2 here. We need to find a way to send the cookies exactly like Amazon does. |
Co-authored-by: Denis Alustau <denisalustau@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why no test changed? Are you able to add a test that covers the change? (maybe we need a test with a cookie value containing special characters?)
@@ -37,12 +37,14 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 { | |||
const bodyString = request.method === 'GET' ? '' : request.body.toString('utf8'); | |||
const shouldSendBase64 = request.method === 'GET' ? false : bodyString.includes('Content-Disposition: form-data'); | |||
|
|||
const cookies = request.headers.cookie ? request.headers.cookie.split('; ') : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this might break if a cookie contains the ;
character, could you add a test to cover that scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 of course sorry, that makes sense!
Co-authored-by: Denis Alustau <denisalustau@gmail.com>
@mnapoli tests added! |
Awesome thanks! |
Without parsing cookies, the attribute
request.cookies
is always empty