Comparing version 3.1.3 to 3.2.0
@@ -319,2 +319,8 @@ 'use strict'; | ||
exports.locked = function (message, data) { | ||
return internals.create(423, message, data, exports.locked); | ||
}; | ||
exports.preconditionRequired = function (message, data) { | ||
@@ -321,0 +327,0 @@ |
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "3.1.3", | ||
"version": "3.2.0", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -35,2 +35,3 @@ ![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) | ||
- [`Boom.badData([message], [data])`](#boombaddatamessage-data) | ||
- [`Boom.locked([message], [data])`](#boomlockedmessage-data) | ||
- [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data) | ||
@@ -512,2 +513,22 @@ - [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data) | ||
### `Boom.locked([message], [data])` | ||
Returns a 423 Locked error where: | ||
- `message` - optional message. | ||
- `data` - optional additional error data. | ||
```js | ||
Boom.locked('this resource has been locked'); | ||
``` | ||
Generates the following response payload: | ||
```json | ||
{ | ||
"statusCode": 423, | ||
"error": "Locked", | ||
"message": "this resource has been locked" | ||
} | ||
``` | ||
### `Boom.preconditionRequired([message], [data])` | ||
@@ -514,0 +535,0 @@ |
@@ -466,2 +466,18 @@ 'use strict'; | ||
describe('locked()', () => { | ||
it('returns a 423 error statusCode', (done) => { | ||
expect(Boom.locked().output.statusCode).to.equal(423); | ||
done(); | ||
}); | ||
it('sets the message with the passed in message', (done) => { | ||
expect(Boom.locked('my message').message).to.equal('my message'); | ||
done(); | ||
}); | ||
}); | ||
describe('preconditionRequired()', () => { | ||
@@ -468,0 +484,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
77899
750
702