awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.05k stars 197 forks source link

Pass context.Context from Lambda runtime to http.Request. #28

Closed snabb closed 4 years ago

snabb commented 5 years ago

Fixes https://github.com/awslabs/aws-lambda-go-api-proxy/issues/27

Issue #, if available: 27

Description of changes: Pass context.Context from Lambda runtime to http.Request.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

snabb commented 5 years ago

This could be also fixed in core/request.go ProxyEventToHTTPRequest function. In that case the context would have to be added as an additional argument to that function which would break backward compatibility.

Therefore I chose to implement the context pass-through in every Proxy function instead.

wolfeidau commented 4 years ago

Was there a problem with this change? Would love to see it reviewed.

sapessi commented 4 years ago

This was fixed in #33 by adding the new ProxyWithContext method to avoid breaking changes.