diff --git a/adapter.go b/adapter.go index f228d7e..194c578 100644 --- a/adapter.go +++ b/adapter.go @@ -10,6 +10,19 @@ import ( "github.com/aws/aws-lambda-go/lambda" ) +// 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 New(handler http.Handler, opts *Options) lambda.Handler { + if handler == nil { + handler = http.DefaultServeMux + } + if opts == nil { + opts = defaultOptions + } + opts.setBinaryContentTypeMap() + return lambdaHandler{httpHandler: handler, opts: opts} +} + var defaultOptions = &Options{} type lambdaHandler struct {