From f98705f27b29ebfd9f8d56f3417895d7d84e118c Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Wed, 6 May 2015 18:40:04 +0200 Subject: [PATCH] Add test for proxy error --- test/setup.js | 3 +++ test/test.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/test/setup.js b/test/setup.js index 748a734..753398f 100644 --- a/test/setup.js +++ b/test/setup.js @@ -87,6 +87,9 @@ nock('http://example.com') .reply(302, 'redirecting ad infinitum...', { 'Location': '/redirectloop' }) + + .get('/proxyerror') + .replyWithError('throw node') ; echoheaders('http://example.com'); diff --git a/test/test.js b/test/test.js index 2403bf9..3e61774 100644 --- a/test/test.js +++ b/test/test.js @@ -263,6 +263,13 @@ describe('Basic functionality', function() { }) .end(done); }); + + it('Proxy error', function(done) { + request(cors_anywhere) + .get('/example.com/proxyerror') + .expect('Access-Control-Allow-Origin', '*') + .expect(404, 'Not found because of proxy error: Error: throw node', done); + }); }); describe('server on https', function() {