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() {