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

ibm-blockchain-js

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-blockchain-js - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

30

lib/rest.js

@@ -12,4 +12,4 @@ 'use strict';

/*
Version: 0.6.4
Updated: 4/01/2015
Version: 0.6.5
Updated: 5/23/2015
-----------------------------------------------------------------

@@ -100,2 +100,5 @@ Use: var rest = require('./rest');

var id = ids[Math.floor(Math.random() * ids.length)]; //random letter to help id calls when there are multiple rest calls
var cb_fired = false;
var request = null;
options = mergeBtoA(default_options, options);

@@ -105,11 +108,17 @@

function success(statusCode, headers, resp){ //go to success callback
if(options.include_headers) resp = {response:resp, headers: headers};
if(jQuery) options.success(statusCode, resp);
else if(nodeJs) options.cb(null, resp); //if neither callback set, don't do either
if(cb_fired === false){
cb_fired = true;
if(options.include_headers) resp = {response:resp, headers: headers};
if(jQuery) return options.success(statusCode, resp);
else if(nodeJs) return options.cb(null, resp); //if neither callback set, don't do either
}
}
function failure(statusCode, headers, msg){ //go to failure callback
if(options.include_headers) msg = {response:msg, headers: headers};
if(jQuery) options.failure(statusCode, msg);
else if(nodeJs) options.cb(statusCode, msg); //if neither callback set, don't do either
if(cb_fired === false){ //prevent mutliple callbacks b/c of on error and on timeout
cb_fired = true;
if(options.include_headers) msg = {response:msg, headers: headers};
if(jQuery) return options.failure(statusCode, msg);
else if(nodeJs) return options.cb(statusCode, msg); //if neither callback set, don't do either
}
}

@@ -159,3 +168,3 @@

if(typeof parameters == 'object') options.path += '?' + querystring.stringify(parameters); //should be a json object
var request = http.request(options, function(resp) {
request = http.request(options, function(resp) {
var str = '', temp, chunks = 0;

@@ -186,3 +195,3 @@ if(!options.quiet) logger.debug(http_txt + ' Status code: ' + resp.statusCode);

if(goodJSON){
//if(!options.quiet) logger.debug(http_txt + ' Data:', str); //all good [json resp]
//if(!options.quiet) logger.debug(http_txt + ' Data:', str); //all good [json resp]
success(resp.statusCode, resp.headers, temp);

@@ -218,3 +227,2 @@ }

failure(408, null, 'Request timed out');
request.destroy();
});

@@ -221,0 +229,0 @@

{
"name": "ibm-blockchain-js",
"version": "1.2.2",
"version": "1.2.3",
"description": "A library for easily interacting with IBM Blockchain.",

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

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