From 98e67efe7bb3ff94d462c3efb426f9b036335cb1 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 29 Feb 2020 19:10:31 -0800 Subject: [PATCH] Added getter for requestContextKey --- context.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/context.go b/context.go index 7ab9369..3f9582b 100644 --- a/context.go +++ b/context.go @@ -6,11 +6,18 @@ import ( "github.com/aws/aws-lambda-go/events" ) -// key is the type used for any items added to the request context. -type key int +// Key is the type used for any items added to the request context. +type Key int // requestContextKey is the key for the api gateway proxy `RequestContext`. -const requestContextKey key = iota +const requestContextKey Key = iota + +// GetRequestContextKey is useful for creating custom claims when testing locally +// ctx := context.WithValue(r.Context(), algnhsa.GetProxyRequestContextKey(), customLocalClaims) +// r = r.Clone(ctx)y +func GetRequestContextKey() Key { + return requestContextKey +} // newContext returns a new Context with specific api gateway proxy values. func newContext(ctx context.Context, e events.APIGatewayProxyRequest) context.Context {