boom
Advanced tools
Comparing version 2.10.1 to 3.0.0
@@ -0,5 +1,7 @@ | ||
'use strict'; | ||
// Load modules | ||
var Http = require('http'); | ||
var Hoek = require('hoek'); | ||
const Http = require('http'); | ||
const Hoek = require('hoek'); | ||
@@ -9,3 +11,3 @@ | ||
var internals = {}; | ||
const internals = {}; | ||
@@ -24,5 +26,6 @@ exports.wrap = function (error, statusCode, message) { | ||
internals.create = function (statusCode, message, data, ctor) { | ||
var error = new Error(message ? message : undefined); // Avoids settings null message | ||
const error = new Error(message ? message : undefined); // Avoids settings null message | ||
Error.captureStackTrace(error, ctor); // Filter the stack to our external API | ||
@@ -34,5 +37,6 @@ error.data = data || null; | ||
internals.initialize = function (error, statusCode, message) { | ||
var numberCode = parseInt(statusCode, 10); | ||
const numberCode = parseInt(statusCode, 10); | ||
Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode); | ||
@@ -94,3 +98,3 @@ | ||
var err = internals.create(401, message, undefined, exports.unauthorized); | ||
const err = internals.create(401, message, undefined, exports.unauthorized); | ||
@@ -101,5 +105,3 @@ if (!scheme) { | ||
var wwwAuthenticate = ''; | ||
var i = 0; | ||
var il = 0; | ||
let wwwAuthenticate = ''; | ||
@@ -117,10 +119,10 @@ if (typeof scheme === 'string') { | ||
if (attributes) { | ||
var names = Object.keys(attributes); | ||
for (i = 0, il = names.length; i < il; ++i) { | ||
var name = names[i]; | ||
const names = Object.keys(attributes); | ||
for (let i = 0; i < names.length; ++i) { | ||
const name = names[i]; | ||
if (i) { | ||
wwwAuthenticate += ','; | ||
wwwAuthenticate = wwwAuthenticate + ','; | ||
} | ||
var value = attributes[name]; | ||
let value = attributes[name]; | ||
if (value === null || | ||
@@ -131,3 +133,3 @@ value === undefined) { // Value can be zero | ||
} | ||
wwwAuthenticate += ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"'; | ||
wwwAuthenticate = wwwAuthenticate + ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"'; | ||
err.output.payload.attributes[name] = value; | ||
@@ -139,5 +141,5 @@ } | ||
if (attributes) { | ||
wwwAuthenticate += ','; | ||
wwwAuthenticate = wwwAuthenticate + ','; | ||
} | ||
wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(message) + '"'; | ||
wwwAuthenticate = wwwAuthenticate + ' error="' + Hoek.escapeHeaderAttribute(message) + '"'; | ||
err.output.payload.attributes.error = message; | ||
@@ -153,9 +155,9 @@ } | ||
var wwwArray = scheme; | ||
for (i = 0, il = wwwArray.length; i < il; ++i) { | ||
const wwwArray = scheme; | ||
for (let i = 0; i < wwwArray.length; ++i) { | ||
if (i) { | ||
wwwAuthenticate += ', '; | ||
wwwAuthenticate = wwwAuthenticate + ', '; | ||
} | ||
wwwAuthenticate += wwwArray[i]; | ||
wwwAuthenticate = wwwAuthenticate + wwwArray[i]; | ||
} | ||
@@ -259,2 +261,3 @@ } | ||
exports.badData = function (message, data) { | ||
@@ -285,8 +288,10 @@ | ||
internals.serverError = function (message, data, statusCode, ctor) { | ||
var error; | ||
let error; | ||
if (data instanceof Error) { | ||
error = exports.wrap(data, statusCode, message); | ||
} else { | ||
} | ||
else { | ||
error = internals.create(statusCode || 500, message, undefined, ctor); | ||
@@ -326,5 +331,5 @@ error.data = data; | ||
var err = internals.serverError(message, data, 500, exports.badImplementation); | ||
const err = internals.serverError(message, data, 500, exports.badImplementation); | ||
err.isDeveloperError = true; | ||
return err; | ||
}; |
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "2.10.1", | ||
"version": "3.0.0", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -12,9 +12,9 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=0.10.40" | ||
"node": ">=4.0.0" | ||
}, | ||
"dependencies": { | ||
"hoek": "2.x.x" | ||
"hoek": "3.x.x" | ||
}, | ||
"devDependencies": { | ||
"code": "1.x.x", | ||
"code": "2.x.x", | ||
"lab": "7.x.x" | ||
@@ -21,0 +21,0 @@ }, |
@@ -0,6 +1,8 @@ | ||
'use strict'; | ||
// Load modules | ||
var Code = require('code'); | ||
var Boom = require('../lib'); | ||
var Lab = require('lab'); | ||
const Code = require('code'); | ||
const Boom = require('../lib'); | ||
const Lab = require('lab'); | ||
@@ -10,3 +12,3 @@ | ||
var internals = {}; | ||
const internals = {}; | ||
@@ -16,12 +18,12 @@ | ||
var lab = exports.lab = Lab.script(); | ||
var describe = lab.describe; | ||
var it = lab.it; | ||
var expect = Code.expect; | ||
const lab = exports.lab = Lab.script(); | ||
const describe = lab.describe; | ||
const it = lab.it; | ||
const expect = Code.expect; | ||
it('returns the same object when already boom', function (done) { | ||
it('returns the same object when already boom', (done) => { | ||
var error = Boom.badRequest(); | ||
var wrapped = Boom.wrap(error); | ||
const error = Boom.badRequest(); | ||
const wrapped = Boom.wrap(error); | ||
expect(error).to.equal(wrapped); | ||
@@ -31,7 +33,7 @@ done(); | ||
it('returns an error with info when constructed using another error', function (done) { | ||
it('returns an error with info when constructed using another error', (done) => { | ||
var error = new Error('ka-boom'); | ||
const error = new Error('ka-boom'); | ||
error.xyz = 123; | ||
var err = Boom.wrap(error); | ||
const err = Boom.wrap(error); | ||
expect(err.xyz).to.equal(123); | ||
@@ -52,7 +54,7 @@ expect(err.message).to.equal('ka-boom'); | ||
it('does not override data when constructed using another error', function (done) { | ||
it('does not override data when constructed using another error', (done) => { | ||
var error = new Error('ka-boom'); | ||
const error = new Error('ka-boom'); | ||
error.data = { useful: 'data' }; | ||
var err = Boom.wrap(error); | ||
const err = Boom.wrap(error); | ||
expect(err.data).to.equal(error.data); | ||
@@ -62,6 +64,6 @@ done(); | ||
it('sets new message when none exists', function (done) { | ||
it('sets new message when none exists', (done) => { | ||
var error = new Error(); | ||
var wrapped = Boom.wrap(error, 400, 'something bad'); | ||
const error = new Error(); | ||
const wrapped = Boom.wrap(error, 400, 'something bad'); | ||
expect(wrapped.message).to.equal('something bad'); | ||
@@ -71,5 +73,5 @@ done(); | ||
it('throws when statusCode is not a number', function (done) { | ||
it('throws when statusCode is not a number', (done) => { | ||
expect(function () { | ||
expect(() => { | ||
@@ -81,12 +83,14 @@ Boom.create('x'); | ||
it('will cast a number-string to an integer', function (done) { | ||
it('will cast a number-string to an integer', (done) => { | ||
var codes = [ | ||
const codes = [ | ||
{ input: '404', result: 404 }, | ||
{ input: '404.1', result: 404 }, | ||
{ input: 400, result: 400 }, | ||
{ input: 400.123, result: 400 }]; | ||
for (var i = 0, il = codes.length; i < il; ++i) { | ||
var code = codes[i]; | ||
var err = Boom.create(code.input); | ||
{ input: 400.123, result: 400 } | ||
]; | ||
for (let i = 0; i < codes.length; ++i) { | ||
const code = codes[i]; | ||
const err = Boom.create(code.input); | ||
expect(err.output.statusCode).to.equal(code.result); | ||
@@ -98,5 +102,5 @@ } | ||
it('throws when statusCode is not finite', function (done) { | ||
it('throws when statusCode is not finite', (done) => { | ||
expect(function () { | ||
expect(() => { | ||
@@ -108,5 +112,5 @@ Boom.create(1 / 0); | ||
it('sets error code to unknown', function (done) { | ||
it('sets error code to unknown', (done) => { | ||
var err = Boom.create(999); | ||
const err = Boom.create(999); | ||
expect(err.output.payload.error).to.equal('Unknown'); | ||
@@ -116,7 +120,7 @@ done(); | ||
describe('create()', function () { | ||
describe('create()', () => { | ||
it('does not sets null message', function (done) { | ||
it('does not sets null message', (done) => { | ||
var error = Boom.unauthorized(null); | ||
const error = Boom.unauthorized(null); | ||
expect(error.output.payload.message).to.not.exist(); | ||
@@ -127,5 +131,5 @@ expect(error.isServer).to.be.false(); | ||
it('sets message and data', function (done) { | ||
it('sets message and data', (done) => { | ||
var error = Boom.badRequest('Missing data', { type: 'user' }); | ||
const error = Boom.badRequest('Missing data', { type: 'user' }); | ||
expect(error.data.type).to.equal('user'); | ||
@@ -137,5 +141,5 @@ expect(error.output.payload.message).to.equal('Missing data'); | ||
describe('isBoom()', function () { | ||
describe('isBoom()', () => { | ||
it('returns true for Boom object', function (done) { | ||
it('returns true for Boom object', (done) => { | ||
@@ -146,3 +150,3 @@ expect(Boom.badRequest().isBoom).to.equal(true); | ||
it('returns false for Error object', function (done) { | ||
it('returns false for Error object', (done) => { | ||
@@ -154,7 +158,7 @@ expect((new Error()).isBoom).to.not.exist(); | ||
describe('badRequest()', function () { | ||
describe('badRequest()', () => { | ||
it('returns a 400 error statusCode', function (done) { | ||
it('returns a 400 error statusCode', (done) => { | ||
var error = Boom.badRequest(); | ||
const error = Boom.badRequest(); | ||
@@ -166,3 +170,3 @@ expect(error.output.statusCode).to.equal(400); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -173,3 +177,3 @@ expect(Boom.badRequest('my message').message).to.equal('my message'); | ||
it('sets the message to HTTP status if none provided', function (done) { | ||
it('sets the message to HTTP status if none provided', (done) => { | ||
@@ -181,7 +185,7 @@ expect(Boom.badRequest().message).to.equal('Bad Request'); | ||
describe('unauthorized()', function () { | ||
describe('unauthorized()', () => { | ||
it('returns a 401 error statusCode', function (done) { | ||
it('returns a 401 error statusCode', (done) => { | ||
var err = Boom.unauthorized(); | ||
const err = Boom.unauthorized(); | ||
expect(err.output.statusCode).to.equal(401); | ||
@@ -192,3 +196,3 @@ expect(err.output.headers).to.deep.equal({}); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -199,5 +203,5 @@ expect(Boom.unauthorized('my message').message).to.equal('my message'); | ||
it('returns a WWW-Authenticate header when passed a scheme', function (done) { | ||
it('returns a WWW-Authenticate header when passed a scheme', (done) => { | ||
var err = Boom.unauthorized('boom', 'Test'); | ||
const err = Boom.unauthorized('boom', 'Test'); | ||
expect(err.output.statusCode).to.equal(401); | ||
@@ -208,5 +212,5 @@ expect(err.output.headers['WWW-Authenticate']).to.equal('Test error="boom"'); | ||
it('returns a WWW-Authenticate header set to the schema array value', function (done) { | ||
it('returns a WWW-Authenticate header set to the schema array value', (done) => { | ||
var err = Boom.unauthorized(null, ['Test','one','two']); | ||
const err = Boom.unauthorized(null, ['Test', 'one', 'two']); | ||
expect(err.output.statusCode).to.equal(401); | ||
@@ -217,5 +221,5 @@ expect(err.output.headers['WWW-Authenticate']).to.equal('Test, one, two'); | ||
it('returns a WWW-Authenticate header when passed a scheme and attributes', function (done) { | ||
it('returns a WWW-Authenticate header when passed a scheme and attributes', (done) => { | ||
var err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 }); | ||
const err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 }); | ||
expect(err.output.statusCode).to.equal(401); | ||
@@ -227,5 +231,5 @@ expect(err.output.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0", error="boom"'); | ||
it('returns a WWW-Authenticate header when passed attributes, missing error', function (done) { | ||
it('returns a WWW-Authenticate header when passed attributes, missing error', (done) => { | ||
var err = Boom.unauthorized(null, 'Test', { a: 1, b: 'something', c: null, d: 0 }); | ||
const err = Boom.unauthorized(null, 'Test', { a: 1, b: 'something', c: null, d: 0 }); | ||
expect(err.output.statusCode).to.equal(401); | ||
@@ -237,5 +241,5 @@ expect(err.output.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0"'); | ||
it('sets the isMissing flag when error message is empty', function (done) { | ||
it('sets the isMissing flag when error message is empty', (done) => { | ||
var err = Boom.unauthorized('', 'Basic'); | ||
const err = Boom.unauthorized('', 'Basic'); | ||
expect(err.isMissing).to.equal(true); | ||
@@ -245,5 +249,5 @@ done(); | ||
it('does not set the isMissing flag when error message is not empty', function (done) { | ||
it('does not set the isMissing flag when error message is not empty', (done) => { | ||
var err = Boom.unauthorized('message', 'Basic'); | ||
const err = Boom.unauthorized('message', 'Basic'); | ||
expect(err.isMissing).to.equal(undefined); | ||
@@ -253,5 +257,5 @@ done(); | ||
it('sets a WWW-Authenticate when passed as an array', function (done) { | ||
it('sets a WWW-Authenticate when passed as an array', (done) => { | ||
var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']); | ||
const err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']); | ||
expect(err.output.headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"'); | ||
@@ -263,5 +267,5 @@ done(); | ||
describe('methodNotAllowed()', function () { | ||
describe('methodNotAllowed()', () => { | ||
it('returns a 405 error statusCode', function (done) { | ||
it('returns a 405 error statusCode', (done) => { | ||
@@ -272,3 +276,3 @@ expect(Boom.methodNotAllowed().output.statusCode).to.equal(405); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -281,5 +285,5 @@ expect(Boom.methodNotAllowed('my message').message).to.equal('my message'); | ||
describe('notAcceptable()', function () { | ||
describe('notAcceptable()', () => { | ||
it('returns a 406 error statusCode', function (done) { | ||
it('returns a 406 error statusCode', (done) => { | ||
@@ -290,3 +294,3 @@ expect(Boom.notAcceptable().output.statusCode).to.equal(406); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -299,5 +303,5 @@ expect(Boom.notAcceptable('my message').message).to.equal('my message'); | ||
describe('proxyAuthRequired()', function () { | ||
describe('proxyAuthRequired()', () => { | ||
it('returns a 407 error statusCode', function (done) { | ||
it('returns a 407 error statusCode', (done) => { | ||
@@ -308,3 +312,3 @@ expect(Boom.proxyAuthRequired().output.statusCode).to.equal(407); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -317,5 +321,5 @@ expect(Boom.proxyAuthRequired('my message').message).to.equal('my message'); | ||
describe('clientTimeout()', function () { | ||
describe('clientTimeout()', () => { | ||
it('returns a 408 error statusCode', function (done) { | ||
it('returns a 408 error statusCode', (done) => { | ||
@@ -326,3 +330,3 @@ expect(Boom.clientTimeout().output.statusCode).to.equal(408); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -335,5 +339,5 @@ expect(Boom.clientTimeout('my message').message).to.equal('my message'); | ||
describe('conflict()', function () { | ||
describe('conflict()', () => { | ||
it('returns a 409 error statusCode', function (done) { | ||
it('returns a 409 error statusCode', (done) => { | ||
@@ -344,3 +348,3 @@ expect(Boom.conflict().output.statusCode).to.equal(409); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -353,5 +357,5 @@ expect(Boom.conflict('my message').message).to.equal('my message'); | ||
describe('resourceGone()', function () { | ||
describe('resourceGone()', () => { | ||
it('returns a 410 error statusCode', function (done) { | ||
it('returns a 410 error statusCode', (done) => { | ||
@@ -362,3 +366,3 @@ expect(Boom.resourceGone().output.statusCode).to.equal(410); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -371,5 +375,5 @@ expect(Boom.resourceGone('my message').message).to.equal('my message'); | ||
describe('lengthRequired()', function () { | ||
describe('lengthRequired()', () => { | ||
it('returns a 411 error statusCode', function (done) { | ||
it('returns a 411 error statusCode', (done) => { | ||
@@ -380,3 +384,3 @@ expect(Boom.lengthRequired().output.statusCode).to.equal(411); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -389,5 +393,5 @@ expect(Boom.lengthRequired('my message').message).to.equal('my message'); | ||
describe('preconditionFailed()', function () { | ||
describe('preconditionFailed()', () => { | ||
it('returns a 412 error statusCode', function (done) { | ||
it('returns a 412 error statusCode', (done) => { | ||
@@ -398,3 +402,3 @@ expect(Boom.preconditionFailed().output.statusCode).to.equal(412); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -407,5 +411,5 @@ expect(Boom.preconditionFailed('my message').message).to.equal('my message'); | ||
describe('entityTooLarge()', function () { | ||
describe('entityTooLarge()', () => { | ||
it('returns a 413 error statusCode', function (done) { | ||
it('returns a 413 error statusCode', (done) => { | ||
@@ -416,3 +420,3 @@ expect(Boom.entityTooLarge().output.statusCode).to.equal(413); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -425,5 +429,5 @@ expect(Boom.entityTooLarge('my message').message).to.equal('my message'); | ||
describe('uriTooLong()', function () { | ||
describe('uriTooLong()', () => { | ||
it('returns a 414 error statusCode', function (done) { | ||
it('returns a 414 error statusCode', (done) => { | ||
@@ -434,3 +438,3 @@ expect(Boom.uriTooLong().output.statusCode).to.equal(414); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -443,5 +447,5 @@ expect(Boom.uriTooLong('my message').message).to.equal('my message'); | ||
describe('unsupportedMediaType()', function () { | ||
describe('unsupportedMediaType()', () => { | ||
it('returns a 415 error statusCode', function (done) { | ||
it('returns a 415 error statusCode', (done) => { | ||
@@ -452,3 +456,3 @@ expect(Boom.unsupportedMediaType().output.statusCode).to.equal(415); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -461,5 +465,5 @@ expect(Boom.unsupportedMediaType('my message').message).to.equal('my message'); | ||
describe('rangeNotSatisfiable()', function () { | ||
describe('rangeNotSatisfiable()', () => { | ||
it('returns a 416 error statusCode', function (done) { | ||
it('returns a 416 error statusCode', (done) => { | ||
@@ -470,3 +474,3 @@ expect(Boom.rangeNotSatisfiable().output.statusCode).to.equal(416); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -479,5 +483,5 @@ expect(Boom.rangeNotSatisfiable('my message').message).to.equal('my message'); | ||
describe('expectationFailed()', function () { | ||
describe('expectationFailed()', () => { | ||
it('returns a 417 error statusCode', function (done) { | ||
it('returns a 417 error statusCode', (done) => { | ||
@@ -488,3 +492,3 @@ expect(Boom.expectationFailed().output.statusCode).to.equal(417); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -497,5 +501,5 @@ expect(Boom.expectationFailed('my message').message).to.equal('my message'); | ||
describe('badData()', function () { | ||
describe('badData()', () => { | ||
it('returns a 422 error statusCode', function (done) { | ||
it('returns a 422 error statusCode', (done) => { | ||
@@ -506,3 +510,3 @@ expect(Boom.badData().output.statusCode).to.equal(422); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -515,5 +519,5 @@ expect(Boom.badData('my message').message).to.equal('my message'); | ||
describe('preconditionRequired()', function () { | ||
describe('preconditionRequired()', () => { | ||
it('returns a 428 error statusCode', function (done) { | ||
it('returns a 428 error statusCode', (done) => { | ||
@@ -524,3 +528,3 @@ expect(Boom.preconditionRequired().output.statusCode).to.equal(428); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -533,5 +537,5 @@ expect(Boom.preconditionRequired('my message').message).to.equal('my message'); | ||
describe('tooManyRequests()', function () { | ||
describe('tooManyRequests()', () => { | ||
it('returns a 429 error statusCode', function (done) { | ||
it('returns a 429 error statusCode', (done) => { | ||
@@ -542,3 +546,3 @@ expect(Boom.tooManyRequests().output.statusCode).to.equal(429); | ||
it('sets the message with the passed-in message', function (done) { | ||
it('sets the message with the passed-in message', (done) => { | ||
@@ -550,5 +554,5 @@ expect(Boom.tooManyRequests('my message').message).to.equal('my message'); | ||
describe('serverTimeout()', function () { | ||
describe('serverTimeout()', () => { | ||
it('returns a 503 error statusCode', function (done) { | ||
it('returns a 503 error statusCode', (done) => { | ||
@@ -559,3 +563,3 @@ expect(Boom.serverTimeout().output.statusCode).to.equal(503); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -567,5 +571,5 @@ expect(Boom.serverTimeout('my message').message).to.equal('my message'); | ||
describe('forbidden()', function () { | ||
describe('forbidden()', () => { | ||
it('returns a 403 error statusCode', function (done) { | ||
it('returns a 403 error statusCode', (done) => { | ||
@@ -576,3 +580,3 @@ expect(Boom.forbidden().output.statusCode).to.equal(403); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -584,5 +588,5 @@ expect(Boom.forbidden('my message').message).to.equal('my message'); | ||
describe('notFound()', function () { | ||
describe('notFound()', () => { | ||
it('returns a 404 error statusCode', function (done) { | ||
it('returns a 404 error statusCode', (done) => { | ||
@@ -593,3 +597,3 @@ expect(Boom.notFound().output.statusCode).to.equal(404); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -601,5 +605,5 @@ expect(Boom.notFound('my message').message).to.equal('my message'); | ||
describe('internal()', function () { | ||
describe('internal()', () => { | ||
it('returns a 500 error statusCode', function (done) { | ||
it('returns a 500 error statusCode', (done) => { | ||
@@ -610,5 +614,5 @@ expect(Boom.internal().output.statusCode).to.equal(500); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
var err = Boom.internal('my message'); | ||
const err = Boom.internal('my message'); | ||
expect(err.message).to.equal('my message'); | ||
@@ -620,3 +624,3 @@ expect(err.isServer).to.true(); | ||
it('passes data on the callback if its passed in', function (done) { | ||
it('passes data on the callback if its passed in', (done) => { | ||
@@ -627,3 +631,3 @@ expect(Boom.internal('my message', { my: 'data' }).data.my).to.equal('data'); | ||
it('returns an error with composite message', function (done) { | ||
it('returns an error with composite message', (done) => { | ||
@@ -634,3 +638,3 @@ try { | ||
catch (err) { | ||
var boom = Boom.internal('Someting bad', err); | ||
const boom = Boom.internal('Someting bad', err); | ||
expect(boom.message).to.equal('Someting bad: Unexpected end of input'); | ||
@@ -643,5 +647,5 @@ expect(boom.isServer).to.be.true(); | ||
describe('notImplemented()', function () { | ||
describe('notImplemented()', () => { | ||
it('returns a 501 error statusCode', function (done) { | ||
it('returns a 501 error statusCode', (done) => { | ||
@@ -652,3 +656,3 @@ expect(Boom.notImplemented().output.statusCode).to.equal(501); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -661,5 +665,5 @@ expect(Boom.notImplemented('my message').message).to.equal('my message'); | ||
describe('badGateway()', function () { | ||
describe('badGateway()', () => { | ||
it('returns a 502 error statusCode', function (done) { | ||
it('returns a 502 error statusCode', (done) => { | ||
@@ -670,3 +674,3 @@ expect(Boom.badGateway().output.statusCode).to.equal(502); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -678,5 +682,5 @@ expect(Boom.badGateway('my message').message).to.equal('my message'); | ||
describe('gatewayTimeout()', function () { | ||
describe('gatewayTimeout()', () => { | ||
it('returns a 504 error statusCode', function (done) { | ||
it('returns a 504 error statusCode', (done) => { | ||
@@ -687,3 +691,3 @@ expect(Boom.gatewayTimeout().output.statusCode).to.equal(504); | ||
it('sets the message with the passed in message', function (done) { | ||
it('sets the message with the passed in message', (done) => { | ||
@@ -695,7 +699,7 @@ expect(Boom.gatewayTimeout('my message').message).to.equal('my message'); | ||
describe('badImplementation()', function () { | ||
describe('badImplementation()', () => { | ||
it('returns a 500 error statusCode', function (done) { | ||
it('returns a 500 error statusCode', (done) => { | ||
var err = Boom.badImplementation(); | ||
const err = Boom.badImplementation(); | ||
expect(err.output.statusCode).to.equal(500); | ||
@@ -708,5 +712,5 @@ expect(err.isDeveloperError).to.equal(true); | ||
describe('stack trace', function () { | ||
describe('stack trace', () => { | ||
it('should omit lib', function (done) { | ||
it('should omit lib', (done) => { | ||
@@ -722,5 +726,5 @@ ['badRequest', 'unauthorized', 'forbidden', 'notFound', 'methodNotAllowed', | ||
'badImplementation' | ||
].forEach(function (name) { | ||
].forEach((name) => { | ||
var err = Boom[name](); | ||
const err = Boom[name](); | ||
expect(err.stack).to.not.match(/\/lib\/index\.js/); | ||
@@ -727,0 +731,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
643
73217
+ Addedhoek@3.0.4(transitive)
- Removedhoek@2.16.3(transitive)
Updatedhoek@3.x.x