Documentation ¶
Index ¶
- func ALBRequestFromContext(ctx context.Context) (events.ALBTargetGroupRequest, bool)
- func APIGatewayV1RequestFromContext(ctx context.Context) (events.APIGatewayProxyRequest, bool)
- func APIGatewayV2RequestFromContext(ctx context.Context) (events.APIGatewayV2HTTPRequest, bool)
- func ListenAndServe(handler http.Handler, opts *Options)
- func New(handler http.Handler, opts *Options) lambda.Handler
- func RequestDebugDumpHandler(w http.ResponseWriter, r *http.Request)
- type Options
- type RequestDebugDump
- type RequestType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ALBRequestFromContext ¶ added in v1.0.0
func ALBRequestFromContext(ctx context.Context) (events.ALBTargetGroupRequest, bool)
ALBRequestFromContext extracts the ALBTargetGroupRequest event from ctx.
func APIGatewayV1RequestFromContext ¶ added in v1.0.0
func APIGatewayV1RequestFromContext(ctx context.Context) (events.APIGatewayProxyRequest, bool)
APIGatewayV1RequestFromContext extracts the APIGatewayProxyRequest event from ctx.
func APIGatewayV2RequestFromContext ¶ added in v1.0.0
func APIGatewayV2RequestFromContext(ctx context.Context) (events.APIGatewayV2HTTPRequest, bool)
APIGatewayV2RequestFromContext extracts the APIGatewayV2HTTPRequest event from ctx.
func ListenAndServe ¶
ListenAndServe starts the AWS Lambda runtime (aws-lambda-go lambda.Start) with a given handler.
func New ¶ added in v1.1.0
New returns a new lambda handler for the given http.Handler. It is up to the caller of New to run lamdba.Start(handler) with the returned handler.
func RequestDebugDumpHandler ¶ added in v1.0.0
func RequestDebugDumpHandler(w http.ResponseWriter, r *http.Request)
RequestDebugDumpHandler is an HTTP handler that returns JSON encoded RequestDebugDump.
Types ¶
type Options ¶
type Options struct { // RequestType sets the expected request type. // By default, algnhsa deduces the request type from the lambda function payload. RequestType RequestType // BinaryContentTypes sets content types that should be treated as binary types. // The "*/* value makes algnhsa treat any content type as binary. BinaryContentTypes []string // Use API Gateway PathParameters["proxy"] when constructing the request url. // Strips the base path mapping when using a custom domain with API Gateway. UseProxyPath bool // DebugLog enables printing request and response objects to stdout. DebugLog bool // contains filtered or unexported fields }
Options holds the optional parameters.
type RequestDebugDump ¶ added in v1.0.0
type RequestDebugDump struct { Method string URL struct { Path string RawPath string } RequestURI string Host string RemoteAddr string Header map[string][]string Form map[string][]string Body string APIGatewayV1Request *events.APIGatewayProxyRequest `json:",omitempty"` APIGatewayV2Request *events.APIGatewayV2HTTPRequest `json:",omitempty"` ALBRequest *events.ALBTargetGroupRequest `json:",omitempty"` }
RequestDebugDump is a dump of the HTTP request including the original Lambda event.
func NewRequestDebugDump ¶ added in v1.0.0
func NewRequestDebugDump(r *http.Request) (*RequestDebugDump, error)
NewRequestDebugDump creates a new RequestDebugDump from an HTTP request.
type RequestType ¶ added in v0.12.0
type RequestType int
const ( RequestTypeAuto RequestType = iota RequestTypeAPIGatewayV1 RequestTypeAPIGatewayV2 RequestTypeALB )