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

eh-api-client

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eh-api-client - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0

readme.md

9

index.js

@@ -18,2 +18,5 @@ var

});
this.requestOptions = {
timeout: 300000
};
this.Client = getClientClass();

@@ -32,5 +35,9 @@ };

Factory.prototype.setRequestOptions = function(options) {
_.extend(this.requestOptions, options);
};
Factory.prototype.setAgentOptions = function(options) {
_.defaults(options, {keepAlive: true});
self.agent = new Agent(options);
this.agent = new Agent(options);
};

@@ -37,0 +44,0 @@

@@ -43,5 +43,16 @@ var

}
if(error.httpStatus >= 500 && error.httpStatus < 600 && !error.hasOwnProperty("name")) {
error.name = "ServerError";
}
return error;
}
function buildNetworkError(res, origErr, url, method) {
var error = new Error();
error.httpURL = url;
error.name = "NetworkError";
error.message = origErr.code;
return error;
}
module.exports = function() {

@@ -145,3 +156,3 @@ var Client = function(apiURL, options) {

if(err) {
return deferred.reject(err);
return deferred.reject(buildNetworkError(res, err, reqParams.url, method));
}

@@ -168,2 +179,3 @@ if(res.statusCode < 200 || res.statusCode >= 300) {

_.extend(params, this._factory.retryOptions);
_.extend(params, this._factory.requestOptions);
return request(params, cb);

@@ -170,0 +182,0 @@ };

2

package.json
{
"name": "eh-api-client",
"version": "0.18.0",
"version": "0.19.0",
"description": "Node.js rest client",

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

@@ -53,3 +53,4 @@ var

}
err.code.should.equal("ECONNRESET");
err.name.should.equal("NetworkError");
err.message.should.equal("ECONNRESET");
done();

@@ -56,0 +57,0 @@ });

@@ -91,3 +91,3 @@ var

it("create client with userId = undefined should create guest client", function(done) {
it("create client with userId = undefined should create guest client", function() {
var c = f.getClient(undefined, "web");

@@ -97,3 +97,3 @@ c.internalAuth.should.equal("0:web");

it("create client with userId = null should create guest client", function(done) {
it("create client with userId = null should create guest client", function() {
var c = f.getClient(null, "web");

@@ -100,0 +100,0 @@ c.internalAuth.should.equal("0:web");

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