Skip to content
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

Add requestTimeEpoch to requestContext #697

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -124,7 +124,8 @@
"Alessandro Palumbo (https://github.com/apalumbo)",
"Selcuk Cihan (https://github.com/selcukcihan)",
"G Roques (https://github.com/gbroques)",
"Dustin Belliston (https://github.com/dwbelliston)"
"Dustin Belliston (https://github.com/dwbelliston)",
"kobanyan (https://github.com/kobanyan)"
],
"dependencies": {
"@hapi/boom": "^7.4.2",
Expand Down
1 change: 1 addition & 0 deletions src/createLambdaProxyContext.js
Expand Up @@ -98,6 +98,7 @@ module.exports = function createLambdaProxyContext(request, options, stageVariab
protocol: 'HTTP/1.1',
resourcePath: request.route.path,
httpMethod: request.method.toUpperCase(),
requestTimeEpoch: request.info.received,
},
resource: request.route.path,
httpMethod: request.method.toUpperCase(),
Expand Down
1 change: 1 addition & 0 deletions test/support/RequestBuilder.js
Expand Up @@ -14,6 +14,7 @@ module.exports = class RequestBuilder {
rawPayload: null,
info: {
remoteAddress: '127.0.0.1',
received: 1,
},
};
}
Expand Down
1 change: 1 addition & 0 deletions test/unit/createLambdaProxyContextTest.js
Expand Up @@ -18,6 +18,7 @@ describe('createLambdaProxyContext', () => {
expect(requestContext.identity.userArn).to.eq('offlineContext_userArn');
expect(requestContext.identity.user).to.eq('offlineContext_user');
expect(requestContext.authorizer.principalId).to.eq('offlineContext_authorizer_principalId');
expect(requestContext.requestTimeEpoch).to.eq(1);
};

const stageVariables = {};
Expand Down