diff --git a/API.md b/API.md index 67976a606..a578ef9a8 100755 --- a/API.md +++ b/API.md @@ -1,4 +1,4 @@ -# 13.2.x API Reference +# 13.4.x API Reference - [Server](#server) - [`new Server([options])`](#new-serveroptions) diff --git a/README.md b/README.md index c05e45052..538b7949e 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Lead Maintainer: [Eran Hammer](https://github.com/hueniverse) authentication, and other essential facilities for building web and services applications. **hapi** enables developers to focus on writing reusable application logic in a highly modular and prescriptive approach. -Development version: **13.2.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) +Development version: **13.4.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) [![Build Status](https://secure.travis-ci.org/hapijs/hapi.svg)](http://travis-ci.org/hapijs/hapi) For the latest updates, [change log](http://hapijs.com/updates), and release information visit [hapijs.com](http://hapijs.com) and follow [@hapijs](https://twitter.com/hapijs) on twitter. If you have questions, please open an issue in the diff --git a/lib/validation.js b/lib/validation.js index 753809910..cd870da9d 100755 --- a/lib/validation.js +++ b/lib/validation.js @@ -80,7 +80,7 @@ internals.input = function (source, request, next) { // Prepare error - const error = Boom.badRequest(err.message, err); + const error = (err.isBoom ? err : Boom.badRequest(err.message, err)); error.output.payload.validation = { source: source, keys: [] }; if (err.details) { for (let i = 0; i < err.details.length; ++i) { diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index facda3db0..691900b03 100755 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,15 +1,15 @@ { "name": "hapi", - "version": "13.2.2", + "version": "13.4.0", "dependencies": { "accept": { - "version": "2.1.0" + "version": "2.1.1" }, "ammo": { "version": "2.0.0" }, "boom": { - "version": "3.1.2" + "version": "3.1.3" }, "call": { "version": "3.0.0" @@ -24,25 +24,25 @@ "version": "3.0.0" }, "heavy": { - "version": "4.0.0" + "version": "4.0.1" }, "hoek": { - "version": "3.0.4" + "version": "4.0.0" }, "iron": { "version": "4.0.0" }, "items": { - "version": "2.0.0" + "version": "2.1.0" }, "joi": { - "version": "8.0.4", + "version": "8.1.0", "dependencies": { "isemail": { "version": "2.1.0" }, "moment": { - "version": "2.12.0" + "version": "2.13.0" } } }, @@ -53,7 +53,7 @@ "version": "3.0.0", "dependencies": { "mime-db": { - "version": "1.22.0" + "version": "1.23.0" } } }, @@ -70,7 +70,7 @@ "version": "4.0.1", "dependencies": { "content": { - "version": "3.0.0" + "version": "3.0.1" }, "pez": { "version": "2.1.0", @@ -82,14 +82,14 @@ "version": "2.0.0", "dependencies": { "vise": { - "version": "2.0.0" + "version": "2.0.1" } } } } }, "wreck": { - "version": "7.0.2" + "version": "7.2.0" } } }, diff --git a/package.json b/package.json index 4545f4c89..0e2558a1e 100755 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "hapi", "description": "HTTP Server framework", "homepage": "http://hapijs.com", - "version": "13.3.0", + "version": "13.4.0", "repository": { "type": "git", "url": "git://github.com/hapijs/hapi" @@ -26,7 +26,7 @@ "catbox-memory": "2.x.x", "cryptiles": "3.x.x", "heavy": "4.x.x", - "hoek": "3.x.x", + "hoek": "4.x.x", "iron": "4.x.x", "items": "2.x.x", "joi": "8.x.x", diff --git a/test/validation.js b/test/validation.js index d1cbdfde7..d300e5a8f 100755 --- a/test/validation.js +++ b/test/validation.js @@ -215,6 +215,33 @@ describe('validation', () => { }); }); + it('retains custom validation error', (done) => { + + const server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + + return reply('ok'); + }, + config: { + validate: { + query: { + a: Joi.number().error(Boom.forbidden()) + } + } + } + }); + + server.inject('/?a=abc', (res) => { + + expect(res.statusCode).to.equal(403); + done(); + }); + }); + it('validates valid input with validation options', (done) => { const server = new Hapi.Server();