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

restjs-api

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

restjs-api - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

12

index.js

@@ -62,2 +62,3 @@ var request = require("request");

* oauth - Options for OAuth HMAC-SHA1 signing, see documentation at https://github.com/mikeal/request#oauth-signing
* stream - A boolean that specifies if the response ust be a stream.
* aws - Object containing aws signing information, should have the properties key and secret as well as bucket

@@ -102,11 +103,10 @@ * unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket

request(optionsToUse, function(error, response) {
var result = null;
if (response) {
result = {
if (options.stream) return cb(error, response);
cb(error, response ? {
status: response.statusCode,
headers: response.headers,
body: tryParseBodyAsJson(response)
};
}
cb(error, result);
} : null );
});

@@ -113,0 +113,0 @@ };

{
"name": "restjs-api",
"version": "0.1.1",
"version": "0.1.2",
"description": "Kidozen's connector to invoke REST services",

@@ -5,0 +5,0 @@ "main": "index.js",

var assert = require('assert');
var http = require('http');
var Stream = require('stream');

@@ -83,2 +84,20 @@ describe('Rest connector:', function(){

it("'stream' option must work", function (done) {
server = http.createServer(function (req, res) {
res.setHeader("x-foo", "bar");
res.statusCode = 201;
res.end();
}).listen(9615);
var instance = new Connector(config);
instance.exec({ method:'get', path: '/foo', stream: true}, function(err, result) {
assert.ok(!err);
assert.ok(result instanceof Stream);
assert.equal("bar", result.headers["x-foo"]);
assert.equal(201, result.statusCode);
done();
});
});
describe ("headers", function() {

@@ -85,0 +104,0 @@ it('should use headers from configuration', function (done) {

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