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

boom

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boom - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

58

lib/index.js

@@ -91,3 +91,3 @@ // Load modules

internals.Error.unauthorized = function (error, scheme, attributes) {
internals.Error.unauthorized = function (error, scheme, attributes) { // Or function (error, wwwAuthenticate[])

@@ -100,28 +100,48 @@ var err = new internals.Error(401, error);

var wwwAuthenticate = scheme;
if (attributes) {
var names = Object.keys(attributes);
for (var i = 0, il = names.length; i < il; ++i) {
if (i) {
wwwAuthenticate += ',';
}
var wwwAuthenticate = '';
var value = attributes[names[i]];
if (value === null ||
value === undefined) { // Value can be zero
if (typeof scheme === 'string') {
value = '';
// function (error, scheme, attributes)
wwwAuthenticate = scheme;
if (attributes) {
var names = Object.keys(attributes);
for (var i = 0, il = names.length; i < il; ++i) {
if (i) {
wwwAuthenticate += ',';
}
var value = attributes[names[i]];
if (value === null ||
value === undefined) { // Value can be zero
value = '';
}
wwwAuthenticate += ' ' + names[i] + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
}
wwwAuthenticate += ' ' + names[i] + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
}
}
if (error) {
if (attributes) {
wwwAuthenticate += ',';
if (error) {
if (attributes) {
wwwAuthenticate += ',';
}
wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(error) + '"';
}
wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(error) + '"';
else {
err.isMissing = true;
}
}
else {
err.isMissing = true;
// function (error, wwwAuthenticate[])
var wwwArray = scheme;
for (var i = 0, il = wwwArray.length; i < il; ++i) {
if (i) {
wwwAuthenticate += ', ';
}
wwwAuthenticate += wwwArray[i];
}
}

@@ -128,0 +148,0 @@

{
"name": "boom",
"description": "HTTP-friendly error objects",
"version": "0.1.0",
"version": "0.2.0",
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",

@@ -6,0 +6,0 @@ "contributors": [],

@@ -101,2 +101,9 @@ // Load modules

});
it('sets a WWW-Authenticate when passed as an array', function (done) {
var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']);
expect(err.toResponse().headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"');
done();
});
});

@@ -103,0 +110,0 @@

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