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

lambda-serverless-api

Package Overview
Dependencies
Maintainers
1
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-serverless-api - npm Package Compare versions

Comparing version 1.12.5 to 1.12.6

19

lib/api.js

@@ -31,6 +31,5 @@ const xor = require('lodash.xor');

const generateResponse = (err, resp, callback, rb) => {
const generateResponse = (err, resp, rb) => {
if (err instanceof response.ApiErrorClass) {
return rb.warning(err).then(callback(null, {
return rb.warning(err).then(() => ({
statusCode: err.statusCode,

@@ -45,9 +44,9 @@ body: JSON.stringify({

if (resp instanceof response.ApiResponseClass) {
return callback(null, {
return {
statusCode: resp.statusCode,
body: resp.payload,
headers: resp.headers
});
};
}
return callback(err);
throw err;
};

@@ -69,3 +68,3 @@

return rollbar
.wrap((event, context, callback, rb) => limiter
.wrap((event, context, rb) => limiter
.check(limit, get(event, 'requestContext.identity.sourceIp'))

@@ -76,5 +75,5 @@ .catch(() => {

.then(() => parse(request, params, event))
.then(paramsOut => handler(paramsOut, context, callback, rb))
.then(payload => generateResponse(null, payload, callback, rb))
.catch(err => generateResponse(err, null, callback, rb)));
.then(paramsOut => handler(paramsOut, context, rb))
.then(payload => generateResponse(null, payload, rb))
.catch(err => generateResponse(err, null, rb)));
};

@@ -81,0 +80,0 @@

@@ -24,3 +24,3 @@ {

},
"version": "1.12.5",
"version": "1.12.6",
"scripts": {

@@ -54,3 +54,3 @@ "test": "node gardener && nyc mocha --recursive",

"lambda-rate-limiter": "2.4.3",
"lambda-rollbar": "1.8.2",
"lambda-rollbar": "1.9.1",
"lodash.defaultsdeep": "4.6.0",

@@ -57,0 +57,0 @@ "lodash.get": "4.4.2",

@@ -41,3 +41,3 @@ [![Build Status](https://img.shields.io/travis/simlu/lambda-serverless-api/master.svg)](https://travis-ci.org/simlu/lambda-serverless-api)

api.Str("password", "json")
], process.env.RATE_LIMIT_PER_IP, ([name, email, password], context, callback, rb) => {
], process.env.RATE_LIMIT_PER_IP, ([name, email, password], context, rb) => {
// handle registration logic here ...

@@ -44,0 +44,0 @@ if (new Date().getHours() === 4) {

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