Skip to content

Added getter for requestContextKey #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down