mantil-io / mantil

Build your AWS Lambda-based Go backends quicker than ever
https://www.mantil.com
MIT License
109 stars 3 forks source link

Use payload v2.0 API Gateway integration #109

Closed ianic closed 2 years ago

ianic commented 2 years ago

We are currently using default v1.0 integration

payload_format_version = "2.0"

is missing needed in the aws_apigatewayv2_integration resource to switch to the newer v2.0

reference

IvanVlasic commented 2 years ago

I've changed the payload format to 2.0 for AWS_PROXY integrations. HTTP_PROXY and websocket still only support 1.0.

I've also made necessary changes to mantil.go. There are some differences in data being sent in request. HTTP fields are now in separate struct inside the request context. The current version of mantil.go is compatible with both payload format versions.

Fields multiValueHeaders and multiValueQueryStringParameters are no longer used. Headers are not relevant to us in this case, but query parameters are used in GET requests through queryStringParameters field. In version 2.0. multi value fields values are concatenated with commas instead of being sent as array in multiValueQueryStringParameters. Since comma is valid character in query parameters we can't know if comma present in the value of this field is part of the value or separator for multiple values, this is up to the user to interpret in the code in appropriate manner.

I've also updated version of mantil.go in all examples and templates.