lambda-wrap
Advanced tools
Comparing version 2.0.0 to 2.0.1
'use strict'; | ||
const errorResponse = (error, event, context, callback, logger, options) => { | ||
const headers = options.headers || {}; | ||
const headers = Object.assign({}, options.headers || {}); | ||
@@ -6,0 +6,0 @@ const { |
@@ -10,3 +10,3 @@ 'use strict'; | ||
const response = (data, event, context, callback, logger, options) => { | ||
const headers = options.headers || {}; | ||
const headers = Object.assign({}, options.headers || {}); | ||
@@ -13,0 +13,0 @@ let res = data; |
{ | ||
"name": "lambda-wrap", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "AWS Serverless wrapper for async generators", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -100,2 +100,42 @@ 'use strict'; | ||
}); | ||
it('should not share headers', (done) => { | ||
const wr = lambdaWrap({ headers: { A: 1 } }); | ||
const handler = wr(async (ev) => { | ||
const { body } = ev; | ||
await new Promise(r => setTimeout(r, 10)); | ||
return { | ||
body, | ||
headers: { B: 1 } | ||
}; | ||
}); | ||
const callback = (ctx, data) => { | ||
assert.deepEqual(data.headers, { A: 1, B: 1, 'Content-Type': 'text/plain; charset=utf-8' }); | ||
const handler2 = wr(async (ev) => { | ||
const { body } = ev; | ||
await new Promise(r => setTimeout(r, 10)); | ||
return { | ||
body, | ||
headers: { C: 1 } | ||
}; | ||
}); | ||
const callback2 = (c, dt) => { | ||
assert.deepEqual(dt.headers, { A: 1, C: 1, 'Content-Type': 'text/plain; charset=utf-8' }); | ||
done(); | ||
}; | ||
handler2({ body: 'Hello' }, context, callback2); | ||
}; | ||
handler({ body: 'Hello' }, context, callback); | ||
}); | ||
}); | ||
@@ -102,0 +142,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
33481
691
0