New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flashheart

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flashheart - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

16

lib/client.js

@@ -7,2 +7,3 @@ var _ = require('lodash');

var limit = require('simple-rate-limiter');
var qs = require('querystring');

@@ -25,3 +26,3 @@ var package = require('../package');

const DEFAULT_CIRCUIT_BREAKER_RESET_TIMEOUT = 10000;
const DEFAULT_CIRCUIT_BREAKER_TIMEOUT = 0x7FFFFFFF; // Set high to effectively disable the circuit breaker timeout
const DEFAULT_CIRCUIT_BREAKER_TIMEOUT = 0x7FFFFFFF; // Set high to effectively disable the circuit breaker timeout
const GET = 'get';

@@ -57,3 +58,3 @@ const PUT = 'put';

// enable rate limiting on requests
this.ratedLimitedRequest = limit(function(method, url, opts, cb) {
this.ratedLimitedRequest = limit(function (method, url, opts, cb) {
this.request[method](url, opts, cb);

@@ -102,2 +103,9 @@ }.bind(this)).to(rateLimitLimit).per(rateLimitInterval);

function buildUrl(url, opts) {
if (opts && opts.qs) {
return url + '?' + qs.stringify(opts.qs);
}
return url;
}
Client.prototype._log = function (res) {

@@ -125,2 +133,3 @@ var message = util.format(res.request.method, res.request.href, res.statusCode, res.elapsedTime, 'ms');

Client.prototype._request = function (method, url, opts, cb) {
var client = this;

@@ -143,5 +152,4 @@

}
err = new Error(util.format('Request failed for %s %s', buildUrl(url, opts), err.message));
err = new Error(util.format('Request failed for %s %s', url, err.message));
return cb(err);

@@ -148,0 +156,0 @@ }

{
"name": "flashheart",
"version": "2.6.0",
"version": "2.6.1",
"description": "A fully-featured REST client built for ease-of-use and resilience",

@@ -40,3 +40,3 @@ "main": "index.js",

"mocha": "^3.0.2",
"nock": "^8.0.0",
"nock": "^9.0.4",
"sinon": "^1.15.3"

@@ -43,0 +43,0 @@ },

@@ -181,2 +181,18 @@ var _ = require('lodash');

it('includes the query strings in the url when a request fails', function (done) {
nock.cleanAll();
api.get('/?a=1&b=2').socketDelay(1000).reply(200, responseBody);
client.get(url, {
timeout: 20,
qs: {
a: 1,
b: 2
}
}, function (err) {
assert(err);
assert.equal(err.message, 'Request failed for http://www.example.com/?a=1&b=2 ESOCKETTIMEDOUT');
done();
});
});
it('logs each request at info level when a logger is passed in', function (done) {

@@ -183,0 +199,0 @@ client = Client.createClient({

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