Skip to content

Commit

Permalink
bad host proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed May 13, 2013
1 parent 2340ff3 commit 759c6fc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/integration/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 759c6fc

Please sign in to comment.