@dotcook/lambda-api
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@dotcook/lambda-api", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable no-param-reassign */ | ||
const middy = require('middy'); | ||
@@ -8,11 +9,8 @@ const { jsonBodyParser, httpErrorHandler } = require('middy/middlewares'); | ||
after(handler, next) { | ||
const { response } = handler; | ||
// eslint-disable-next-line no-param-reassign | ||
handler.response = { | ||
statusCode: 200, | ||
body: JSON.stringify({ | ||
...response, | ||
success: true, | ||
}), | ||
}; | ||
const { statusCode, ...response } = handler; | ||
handler.response.statusCode = statusCode || 200; | ||
handler.response.body = JSON.stringify({ | ||
...response, | ||
success: true, | ||
}); | ||
next(); | ||
@@ -25,10 +23,7 @@ }, | ||
console.error(handler.error); | ||
// eslint-disable-next-line no-param-reassign | ||
handler.response = { | ||
statusCode: status, | ||
body: JSON.stringify({ | ||
success: false, | ||
message, | ||
}), | ||
}; | ||
handler.response.statusCode = status; | ||
handler.response.body = JSON.stringify({ | ||
success: false, | ||
message, | ||
}); | ||
}, | ||
@@ -35,0 +30,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3531
76