From 759c6fc977cb80c51e4ae08a141fd444f9033b5d Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Mon, 13 May 2013 15:42:11 -0700 Subject: [PATCH] bad host proxy --- test/integration/proxy.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/integration/proxy.js b/test/integration/proxy.js index bea26c37b..0ac49f7c5 100755 --- a/test/integration/proxy.js +++ b/test/integration/proxy.js @@ -168,7 +168,8 @@ describe('Proxy', function () { { method: 'GET', path: '/google', handler: { proxy: { mapUri: function (request, callback) { callback(null, 'http://www.google.com'); } } } }, { method: 'GET', path: '/googler', handler: { proxy: { mapUri: function (request, callback) { callback(null, 'http://google.com'); }, redirects: 1 } } }, { method: 'GET', path: '/redirect', handler: { proxy: { host: 'localhost', port: backendPort, passThrough: true, redirects: 2 } } }, - { method: 'POST', path: '/post1', handler: { proxy: { host: 'localhost', port: backendPort, redirects: 3 } }, config: { payload: 'stream' } } + { method: 'POST', path: '/post1', handler: { proxy: { host: 'localhost', port: backendPort, redirects: 3 } }, config: { payload: 'stream' } }, + { method: 'GET', path: '/nowhere', handler: { proxy: { host: 'no.such.domain.x8' } } } ]); server.state('auto', { autoValue: 'xyz' }); @@ -397,6 +398,15 @@ describe('Proxy', function () { }); }); + it('errors on redirection to bad host', function (done) { + + server.inject('/nowhere', function (res) { + + expect(res.statusCode).to.equal(500); + done(); + }); + }); + it('redirects to another endpoint', function (done) { server.inject('/redirect', function (res) {