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

lambda-router-adapter

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-router-adapter - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

18

index.js

@@ -15,9 +15,15 @@ var request = require('./request');

*/
function newHandler(callback) {
function newExpressHandler(app) {
app.request.__proto__.__proto__ = request.LambdaHttpRequest.prototype;
app.response.__proto__.__proto__ = response.LambdaHttpResponse.prototype;
return function(event, context) {
var req = request.convert(event);
var res = response.newResponse(function(value) {
context.done(null, response.convert(value));
var lambdaHttpRequest = request.convert(event);
var lambdaHttpResponse = response.newResponse(function(lambdaHttpResponse) {
context.done(null, response.convert(lambdaHttpResponse));
});
callback(req, res);
app.handle(lambdaHttpRequest, lambdaHttpResponse, function(error) {
if(error) {
context.done(error);
}
});
}

@@ -30,3 +36,3 @@ }

newResponse: response.newResponse,
newHandler: newHandler
newExpressHandler: newExpressHandler
}
{
"name": "lambda-router-adapter",
"version": "1.0.8",
"version": "1.0.9",
"description": "Adapts Lambda Router Requests and Responses to NodeJS HTTP Request and Responses",

@@ -22,3 +22,6 @@ "main": "index.js",

"url": "^0.11.0"
},
"devDependencies": {
"express": "^4.13.3"
}
}

@@ -7,2 +7,7 @@ 'use strict';

function LambdaSocket() {
}
LambdaSocket.prototype.destroy = function() {}
/**

@@ -28,4 +33,5 @@ * Converts a Lambda Event to a NodeJS Http Request.

this.headers = lambdaRequest.headers;
this.headers = lambdaRequest.headers || {};
this.body = lambdaRequest.body;
this.socket = new LambdaSocket();
}

@@ -42,2 +48,5 @@

module.exports.convert = convert;
module.exports = {
convert: convert,
LambdaHttpRequest: LambdaHttpRequest
}

@@ -12,2 +12,3 @@ 'use strict';

*
* @class
* @param done

@@ -59,4 +60,6 @@ * @constructor

LambdaHttpResponse.prototype.end = function(data, encoding, callback) {
LambdaHttpResponse.super_.prototype.end.apply(this, data, encoding, callback);
this.done(this);
LambdaHttpResponse.super_.prototype.end.apply(this, arguments);
if(this.done) {
this.done(this);
}
}

@@ -63,0 +66,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