Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lambda-wrap

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-wrap - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

lib/errorResponse.js
'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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc