Stop truncating multi-value headers
timkelty opened this issue · 2 comments
Format 2.0 doesn't have multiValueHeaders or multiValueQueryStringParameters fields. Duplicate headers are combined with commas and included in the headers field
As API Gateway 2.0 doesn't support multiValueHeaders
– Bref takes only the last value.
It seems like a better solution to not do anything and allow APIG to join them with a comma – at least that way there isn't any data loss, and your app can adjust to get the values.
Related: #818
Hi, I'm not sure I understand everything.
Could you clarify with:
- what you expect to happen
- what happens instead
Thanks!
What currently happens
Given a response with multi-value headers (2 unique headers with the same name), Bref will only keep the last header: https://github.com/brefphp/bref/blob/master/src/Event/Http/HttpResponse.php#L37
Eg, given
x-foo: bar
x-foo: baz
The APIG response will be constructed with only x-foo: baz
What I expect to happen
I expect headers with duplicate names to be joined with a ,
, which is API Gateway v2's default behavior:
So, x-foo: bar,baz
Format 2.0 doesn't have multiValueHeaders or multiValueQueryStringParameters fields. Duplicate headers are combined with commas and included in the headers field
So, it seems like Bref shouldn't do any special handling for these headers, and instead rely on APIG's default handling.