Skip to content

Commit

Permalink
Expose event on LambdaRequest class
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed May 22, 2019
1 parent e253303 commit 83066cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ export { Handler, Event, Context, Result };
*/
export interface LambdaRequestOptions extends RequestOptions {
context: Context;
event: Event;
}

/**
* Extends HTTP requests with AWS Lambda context.
*/
export class LambdaRequest extends Request {
context: Context;
event: Event;

constructor(input: string | LambdaRequest, options: LambdaRequestOptions) {
super(input, options);
this.context = options.context;
this.event = options.event;
}
}

Expand Down Expand Up @@ -67,7 +70,8 @@ export function createHandler(app: App, options: Options = {}): Handler {
headers: event.multiValueHeaders,
method,
body,
context
context,
event
});

const mapError = errorhandler(req, {
Expand Down

0 comments on commit 83066cd

Please sign in to comment.