diff --git a/Gopkg.lock b/Gopkg.lock index 95b28b8..85c4c77 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -48,6 +48,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "751d4fc4b7be23b18796aed082f5e83d9ba309c184255d4c63d8225cc0048152" + inputs-digest = "5da761903d61cf9e47d309477db924d6e310f97fbd7c553ff46af570b65d4356" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 5a78b31..4c8db6c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -33,6 +33,10 @@ name = "github.com/aws/aws-lambda-go" version = "1.2.0" +[[constraint]] + name = "github.com/smartystreets/goconvey" + version = "1.6.3" + [prune] go-tests = true unused-packages = true diff --git a/router.go b/router.go index 326f840..03a72e3 100644 --- a/router.go +++ b/router.go @@ -1,6 +1,7 @@ package lambdarouter import ( + "context" "encoding/json" "log" "net/http" @@ -24,6 +25,7 @@ const ( // Fill the Status and Body, or Status and Error to respond. type APIGContext struct { Claims map[string]interface{} + Context context.Context Path map[string]string QryStr map[string]string Request *events.APIGatewayProxyRequest @@ -43,12 +45,14 @@ type APIGRouter struct { params map[string]string prefix string headers map[string]string + context context.Context } // APIGRouterConfig is used as the input to NewAPIGRouter, request is your incoming // apig request and prefix will be stripped of all incoming request paths. Headers // will be sent with all responses. type APIGRouterConfig struct { + Context context.Context Request *events.APIGatewayProxyRequest Prefix string Headers map[string]string @@ -144,6 +148,7 @@ func (r *APIGRouter) Respond() events.APIGatewayProxyResponse { Path: r.request.PathParameters, QryStr: r.request.QueryStringParameters, Request: r.request, + Context: r.context, } if r.request.RequestContext.Authorizer["claims"] != nil { ctx.Claims = r.request.RequestContext.Authorizer["claims"].(map[string]interface{})