Socket
Socket
Sign inDemoInstall

eh-api-client

Package Overview
Dependencies
49
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.24.4 to 0.25.0

test/modify_req.js

13

index.js

@@ -28,2 +28,11 @@ var

this.Client = getClientClass();
this._client;
this.__defineGetter__("client", function() {
if(!this._client) {
this._client = new this.Client(this.apiURL);
this._client._factory = this;
}
return this._client;
});
};

@@ -60,5 +69,3 @@

args.unshift(method);
var c = new this.Client(this.apiURL);
c._factory = this;
return c.request.apply(c, args);
return this.client.request.apply(this.client, args);
};

@@ -65,0 +72,0 @@ });

@@ -60,4 +60,18 @@ var

this._factory = null;
this._requestModificators = [];
};
Client.prototype.addRequestModificator = function(func) {
if(this._requestModificators.indexOf(func) === -1) {
this._requestModificators.push(func);
}
};
Client.prototype.removeRequestModificator = function(func) {
var index = this._requestModificators.indexOf(func);
if(index >= 0) {
this._requestModificators.splice(index, 1);
}
};
Client.prototype.fork = function(subUrl) {

@@ -213,5 +227,10 @@ apiURL = this.apiURL + _url(subUrl);

Client.prototype._makeRequest = function(params, cb) {
var self = this;
params.agent = this._factory.agent;
_.extend(params, this._factory.requestOptions);
return this._tryRequest(params, 1, cb);
return Promise.each(this._requestModificators, function(modificator) {
return modificator(params);
}).then(function() {
return self._tryRequest(params, 1, cb);
});
};

@@ -218,0 +237,0 @@

{
"name": "eh-api-client",
"version": "0.24.4",
"version": "0.25.0",
"description": "Node.js rest client",

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

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