Each integration handle header keys differently, this patch tries to address these differences so that we have proper headers in responses.
Note: I don't currently have time to spin up all these integrations on AWS to test this, so this patch is entirely based on documentation and reference code from awslabs/aws-lambda-go-api-proxy repo. Please feel free to test and leave feedback in the reviews.
The names of the fields used for headers differ depending on whether you enable multi-value headers for the target group. You must use multiValueHeaders if you have enabled multi-value headers and headers otherwise.
If you specify values for both headers and multiValueHeaders, API Gateway merges them into a single list. If the same key-value pair is specified in both, only the values from multiValueHeaders will appear in the merged list.
Format 2.0 doesn't have multiValueHeaders or multiValueQueryStringParameters fields. Duplicate headers are combined with commas and included in the headers field. Duplicate query strings are combined with commas and included in the queryStringParameters field.
Description of changes
Fixes #871 Fixes #876
Each integration handle header keys differently, this patch tries to address these differences so that we have proper headers in responses.
Note: I don't currently have time to spin up all these integrations on AWS to test this, so this patch is entirely based on documentation and reference code from awslabs/aws-lambda-go-api-proxy repo. Please feel free to test and leave feedback in the reviews.
References
ALB Integration https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#multi-value-headers-response
APIGW v1 Integration https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format
APIGW v2 Integration https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
awslabs/aws-lambda-go-api-proxy
source codeBy submitting this pull request