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

be-hippo

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

be-hippo - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

7

lib/client.js

@@ -84,7 +84,8 @@ /**

return new Resource(descriptor, this._options.requestOptions);
}.bind(this))
.catch(function() {
delete this._descriptorCache[uri];
throw new Error('Unable to get descriptor for uri "' + uri + '"');
}.bind(this));
this._descriptorCache[uri].catch(function() {
delete this._descriptorCache[uri];
});
return this._descriptorCache[uri];

@@ -91,0 +92,0 @@ };

@@ -61,6 +61,7 @@ define(['./uritemplate', './xhr'], function(UriTemplate, xhr) {

data = data || {};
options = options || {};
var selfConn = this.getConnection({ name: 'self', data: params });
return xhr(extend(this._requestOptions, options, {
return xhr(extend({}, this._requestOptions, options, {
url: selfConn,

@@ -67,0 +68,0 @@ method: method,

{
"name": "be-hippo",
"version": "2.1.0",
"version": "2.1.1",
"description": "A PropositionH hypermedia consumer",

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

@@ -260,4 +260,33 @@ define(['chai-as-promised', 'lib/client', 'lib/resource'], function(chaiAsPromised, Client, Resource) {

});
describe('when a shortname walk 404s', function() {
var links = {
root: {
_links: {
self: { href: '/v1' },
foo: { href: '/v1/foo{?user}' }
}
},
foo: {
_links: {
self: { href: '/v1/foo{?user}' }
}
}
};
var responses = {
root: [200, { "Content-Type": "application/json" }, JSON.stringify(links.root)],
foo: [404, { "Content-Type": "text/plain" }, ''],
};
it('returns an "Unable to get descriptor" error', function() {
var client = new Client('/v1');
server.respondWith('OPTIONS', '/v1', responses.root);
server.respondWith('OPTIONS', '/v1/foo', responses.foo);
return expect(client.walk('foo')).to.be.rejectedWith(new RegExp('Unable to get descriptor for uri "/v1/foo"'));
});
});
});
});
});

@@ -619,3 +619,50 @@ define(['chai-as-promised', 'lib/resource'], function(chaiAsPromised, Resource) {

});
describe('when multiple requests are made with the same root options', function() {
var server;
var descriptor = {
_links: {
self: {
href: '/v1/foo{?baz}'
}
}
};
var otherDescriptor = {
_links: {
self: {
href: '/v1/bar{?baz}'
}
}
};
beforeEach(function() {
server = sinon.fakeServer.create();
server.autoRespond = true;
});
afterEach(function() {
server.restore();
server = null;
});
it('does not modify the root options object', function() {
var options = { headers: { foo: 'bar' } };
var resource = new Resource(descriptor, options);
var resourceB = new Resource(otherDescriptor, options);
server.respondWith('GET', '/v1/foo', function(req) {
expect(req.requestHeaders.foo).to.equal('baz');
req.respond(200, { "Content-Type": "text/plain" }, '');
});
server.respondWith('GET', '/v1/bar', function(req) {
expect(req.requestHeaders.foo).to.equal('bar');
req.respond(200, { "Content-Type": "text/plain" }, '');
});
return resource.get({}, { headers: { foo: 'baz' } })
.then(function() { return resourceB.get(); });
});
});
});
});
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