Skip to content

Support for multiple cookies in http payload version 2.0#820

Closed
hvipana wants to merge 1 commit intobrefphp:masterfrom
hvipana:cookies-api-gw-2
Closed

Support for multiple cookies in http payload version 2.0#820
hvipana wants to merge 1 commit intobrefphp:masterfrom
hvipana:cookies-api-gw-2

Conversation

@hvipana
Copy link

@hvipana hvipana commented Dec 9, 2020

Fix for #818

For http payload version 2.0 there is no multiValueHeaders field anymore. But to support multiple cookies, a new cookies field was introduced as described here:
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

This PR adds the cookies field to the response and removes the Set-Cookie header, that is now handled by API-Gateway v2.


if (isset($cookies)) {
$response['cookies'] = $cookies;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I'm afraid the cookies key might be added to the v1.0 format too, and the Set-Cookies header will be removed (from v1.0 responses) 🤔

'httpMethod' => 'GET',
])['cookies'];
self::assertEquals('MyCookie=FirstValue; expires=Fri, 12-Jan-2018 08:32:03 GMT; Max-Age=0; path=/hello/; domain=example.com; secure; HttpOnly', $cookieHeader[0]);
self::assertEquals('MyCookie=MyValue; expires=Fri, 12-Jan-2018 08:32:03 GMT; Max-Age=0; path=/hello/; domain=example.com; secure; HttpOnly', $cookieHeader[1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change?

@mnapoli
Copy link
Member

mnapoli commented Jan 15, 2021

Closing until we have some news.

Anyone else feel free to pick up this PR again in a new pull request.

@mnapoli
Copy link
Member

mnapoli commented Jan 18, 2021

FYI I've opened #841 as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants