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

librato-metrics

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

librato-metrics - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

dump.rdb

40

lib/Client.js

@@ -0,3 +1,4 @@

var util = require('util');
var request = require('request');
var url = require('url');
var url = require('url');

@@ -32,23 +33,34 @@ module.exports = Client;

Client.prototype.request = function(options, cb) {
var uri = url.parse(this._endpoint);
uri.auth = this.email + ':' + this.token;
uri = url.format(uri) + options.path;
var requestOptions = {
method : options.method,
uri : uri,
json : options.json,
method : options.method,
uri : this._endpoint + options.path,
json : options.json,
headers : {
authorization: this._authorization(),
},
};
request(requestOptions, function(err, response, body) {
if (body) {
try{
body = JSON.parse(body)
} catch (_err) {
return cb(_err);
}
var code = response.statusCode;
if (!err && ((body && body.errors) || code > 399)) {
err = new Error(
'LibratoMetrics.Error: ' +
util.inspect(body) +
' (statusCode: ' + code + ')'
);
}
try{
if (body) body = JSON.parse(body);
} catch (_err) {
if (!err) err = _err;
}
cb(err, body);
});
};
Client.prototype._authorization = function() {
var credentials = this.email + ':' + this.token;
return 'Basic ' + new Buffer(credentials).toString('base64');
};

@@ -5,3 +5,3 @@ {

"description": "A node module for sending data to librato metrics.",
"version": "0.0.1",
"version": "0.0.3",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -21,4 +21,5 @@ var assert = require('assert');

console.log(response);
assert.equal(response.name, metricName);
});
});
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