Socket
Socket
Sign inDemoInstall

callarest

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callarest - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

json.js

@@ -25,3 +25,3 @@ const ErrorWithObject = require('error-with-object');

try {
rest.body = JSON.parse(rest.body);
rest.body = rest.body !== '' ? JSON.parse(rest.body) : undefined;
} catch (error) {

@@ -28,0 +28,0 @@ return callback(new ErrorWithObject({

{
"name": "callarest",
"version": "1.4.0",
"version": "1.5.0",
"keywords": [

@@ -5,0 +5,0 @@ "rest",

@@ -41,6 +41,7 @@ const http = require('http');

});
response.end(data || JSON.stringify({
const dataToSend = data != null ? data : JSON.stringify({
a: 'you said',
b: body
}));
});
response.end(dataToSend);
});

@@ -51,3 +52,4 @@ } else {

});
response.end(data || JSON.stringify({ success: true }));
const dataToSend = data != null ? data : JSON.stringify({ success: true });
response.end(dataToSend);
}

@@ -54,0 +56,0 @@ }).listen(8000);

@@ -24,2 +24,19 @@ const test = require('tape');

test('get -> success if undefined body returned', t => {
t.plan(3);
const server = righto(createJsonServer, '');
const request = righto(callarestJson, {
url: 'http://localhost:8000'
}, righto.after(server));
request(function (error, result) {
t.notOk(error);
t.ok(result);
t.deepEqual(result.body, undefined);
destroyServer();
});
});
test('get -> net failure', t => {

@@ -26,0 +43,0 @@ t.plan(3);

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