Skip to content
This repository was archived by the owner on Nov 27, 2019. It is now read-only.

Commit a26d36b

Browse files
committed
Fixed some syntax.
Added date and correct requestId.
1 parent d198b31 commit a26d36b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ function R(...params) {
2929
let handler;
3030

3131
if (params.length === 2) {
32-
[settings, handler] = params;
32+
settings = params[0];
33+
handler = params[1];
3334
}
3435

3536
if (params.length === 1) {
36-
[handler] = params;
3737
settings = {};
38+
handler = params[0];
3839
}
3940

4041
const usedSettings = Object.assign({}, defaultSettings, settings);
@@ -64,7 +65,8 @@ function R(...params) {
6465
},
6566
body: JSON.stringify({
6667
status: 'success',
67-
requestId: context.requestId,
68+
date: new Date(),
69+
requestId: `${context.logStreamName}\\${context.awsRequestId}`,
6870
dataAvailable: !isEmpty(response),
6971
executionTimeInMs: calculateExecution(process.hrtime(startTime)),
7072
originalRequest: transformed,
@@ -80,7 +82,8 @@ function R(...params) {
8082
},
8183
body: JSON.stringify({
8284
status: 'error',
83-
requestId: context.requestId,
85+
date: new Date(),
86+
requestId: `${context.logStreamName}\\${context.awsRequestId}`,
8487
dataAvailable: false,
8588
executionTimeInMs: calculateExecution(process.hrtime(startTime)),
8689
originalRequest: transformed,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aws-response",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Aws response handler",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)