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

bender-api

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bender-api - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

40

lib/bender-api.js

@@ -10,20 +10,32 @@ var jsonquest = require('jsonquest');

module.exports = function (options) {
var opts = options || {};
var host = opts.host || 'localhost';
var port = opts.port || 1729;
var opts = options || {
servers: [ { host: '127.0.0.1', port: 1729 } ]
};
var servers = opts.servers;
function request(method, url, body, callback) {
var cb = callback || noop;
var retries = opts.retries || 5;
jsonquest({
method: method,
host: host,
port: port,
path: url,
body: body
}, function (err, res, body) {
function tryRequest() {
var server = servers.shift();
servers.push(server);
jsonquest({
method: method,
host: server.host,
port: server.port,
path: url,
body: body
}, done);
}
function done(err, res, body) {
var msg;
if (err) {
return cb(err);
return retries-- === 0
? cb(err)
: tryRequest();
}

@@ -45,4 +57,6 @@

return cb(null, body);
});
cb(null, body);
}
tryRequest();
}

@@ -49,0 +63,0 @@

{
"name": "bender-api",
"version": "0.0.3",
"version": "0.1.0",
"description": "API for Bender",

@@ -5,0 +5,0 @@ "author": "Vigour.io <dev@vigour.io>",

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