boom
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -30,6 +30,7 @@ // Load modules | ||
Hoek.assert(Hoek.isInteger(statusCode) && statusCode >= 400, 'First argument must be a number (400+):', statusCode); | ||
var numberCode = parseInt(statusCode, 10); | ||
Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode); | ||
error.isBoom = true; | ||
error.isServer = statusCode >= 500; | ||
error.isServer = numberCode >= 500; | ||
@@ -41,3 +42,3 @@ if (!error.hasOwnProperty('data')) { | ||
error.output = { | ||
statusCode: statusCode, | ||
statusCode: numberCode, | ||
payload: {}, | ||
@@ -295,2 +296,1 @@ headers: {} | ||
}; | ||
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -76,2 +76,18 @@ // Load modules | ||
it('will cast a number-string to an integer', function (done) { | ||
var 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); | ||
expect(err.output.statusCode).to.equal(code.result); | ||
} | ||
done(); | ||
}); | ||
it('throws when statusCode is not finite', function (done) { | ||
@@ -78,0 +94,0 @@ |
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
67287
595