Skip to content

Commit

Permalink
Merge pull request #697 from kobanyan/add-requestTimeEpoch-to-request…
Browse files Browse the repository at this point in the history
…Context

Add requestTimeEpoch to requestContext
  • Loading branch information
dherault committed Jun 8, 2019
2 parents 0c1a0f7 + b36c1ff commit 709a2dd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
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

0 comments on commit 709a2dd

Please sign in to comment.