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

elasticio-rest-node

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticio-rest-node - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

9

lib/resource.js

@@ -100,5 +100,14 @@ var Q = require("q");

function checkStatusCode(response, body) {
if (response.statusCode >= 400) {
throw new Error(JSON.stringify(body));
}
return [response, body];
}
return Q()
.then(provideOptions)
.then(sendRequest)
.spread(checkStatusCode)
.spread(prepareResponse);

@@ -105,0 +114,0 @@ }

2

package.json
{
"name": "elasticio-rest-node",
"description": "elastic.io REST API client",
"version": "0.0.4",
"version": "0.0.5",
"author": "elastic.io GmbH <info@elastic.io>",

@@ -6,0 +6,0 @@ "engine": "node >=4.1.0",

@@ -22,2 +22,33 @@ describe('Basic use cases', function () {

});
it('should handle status codes properly', function (done) {
var response = {
"error":"Invalid username or secret provided."
};
nock('https://api.elastic.io')
.get('/v1/users/')
.reply(401, response);
var result;
var error;
users
.me()
.then(function (body) {
result = body;
})
.fail(function(e){
error = e;
})
.finally(function () {
expect(result).toBeUndefined();
expect(error).toBeDefined();
expect(error.message).toEqual('{"error":"Invalid username or secret provided."}');
done();
});
});
});
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