Comparing version 4.1.0 to 4.2.0
@@ -241,5 +241,15 @@ 'use strict'; | ||
exports.methodNotAllowed = function (message, data) { | ||
exports.methodNotAllowed = function (message, data, allow) { | ||
return internals.create(405, message, data, exports.methodNotAllowed); | ||
const err = internals.create(405, message, data, exports.methodNotAllowed); | ||
if (typeof allow === 'string') { | ||
allow = [allow]; | ||
} | ||
if (Array.isArray(allow)) { | ||
err.output.headers.Allow = allow.join(', '); | ||
} | ||
return err; | ||
}; | ||
@@ -246,0 +256,0 @@ |
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -22,3 +22,3 @@ ![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) | ||
- [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data) | ||
- [`Boom.methodNotAllowed([message], [data])`](#boommethodnotallowedmessage-data) | ||
- [`Boom.methodNotAllowed([message], [data], [allow])`](#boommethodnotallowedmessage-data-allow) | ||
- [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data) | ||
@@ -256,3 +256,3 @@ - [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data) | ||
### `Boom.methodNotAllowed([message], [data])` | ||
### `Boom.methodNotAllowed([message], [data], [allow])` | ||
@@ -262,2 +262,3 @@ Returns a 405 Method Not Allowed error where: | ||
- `data` - optional additional error data. | ||
- `allow` - optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. | ||
@@ -264,0 +265,0 @@ ```js |
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
30968
271
724