boom
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -256,2 +256,8 @@ // Load modules | ||
exports.preconditionRequired = function (message, data) { | ||
return internals.create(428, message, data, exports.preconditionRequired); | ||
}; | ||
exports.tooManyRequests = function (message, data) { | ||
@@ -258,0 +264,0 @@ |
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -19,3 +19,3 @@ "main": "lib/index.js", | ||
"code": "1.x.x", | ||
"lab": "5.x.x" | ||
"lab": "6.x.x" | ||
}, | ||
@@ -22,0 +22,0 @@ "scripts": { |
@@ -470,2 +470,22 @@ ![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) | ||
### `Boom.preconditionRequired([message], [data])` | ||
Returns a 428 Precondition Required error where: | ||
- `message` - optional message. | ||
- `data` - optional additional error data. | ||
```js | ||
Boom.preconditionRequired('you must supply an If-Match header'); | ||
``` | ||
Generates the following response payload: | ||
```json | ||
{ | ||
"statusCode": 428, | ||
"error": "Precondition Required", | ||
"message": "you must supply an If-Match header" | ||
} | ||
``` | ||
### `Boom.tooManyRequests([message], [data])` | ||
@@ -472,0 +492,0 @@ |
// Load modules | ||
var Util = require('util'); | ||
var Code = require('code'); | ||
@@ -463,2 +462,18 @@ var Boom = require('../lib'); | ||
describe('preconditionRequired()', function () { | ||
it('returns a 428 error statusCode', function (done) { | ||
expect(Boom.preconditionRequired().output.statusCode).to.equal(428); | ||
done(); | ||
}); | ||
it('sets the message with the passed in message', function (done) { | ||
expect(Boom.preconditionRequired('my message').message).to.equal('my message'); | ||
done(); | ||
}); | ||
}); | ||
describe('tooManyRequests()', function () { | ||
@@ -465,0 +480,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
70441
624
618