Socket
Socket
Sign inDemoInstall

configurapi-handler-json

Package Overview
Dependencies
18
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.10 to 1.0.11

2

package.json
{
"name": "configurapi-handler-json",
"version": "1.0.10",
"version": "1.0.11",
"description": "Configurapi request handlers for JSON requests/responses",

@@ -5,0 +5,0 @@ "main": "src/index",

@@ -31,4 +31,17 @@ const Ajv = require('ajv');

module.exports = function(event, statusCode = 200, body = '', headers = undefined)
function validateEmptyPayload(event)
{
if(event.request.payload === undefined || event.request.payload === '')
{
return true;
}
else
{
event.response = new ErrorResponse('Request payload should be empty.', 400);
return false;
}
}
function validatePayload(event)
{
return new Promise((resolve, reject) => {

@@ -62,2 +75,21 @@

});
}
module.exports = function(event, mode)
{
if(mode === 'emptyPayload')
{
if(validateEmptyPayload(event))
{
this.continue();
}
else
{
this.complete();
}
}
else
{
return validatePayload.apply(this, [event]);
}
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc