Skip to content

Commit

Permalink
[test] test onError part, proxying to no where
Browse files Browse the repository at this point in the history
  • Loading branch information
cronopio committed Aug 28, 2013
1 parent 27df8d7 commit b85aa16
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/lib-caronte-streams-proxy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,29 @@ describe('lib/caronte/streams/proxy.js', function () {
}).end();
});
});

describe('caronte createProxyServer() method with error response', function () {
it('should make the request and response with error', function(done) {
var proxy = caronte.createProxyServer({
target: 'http:https://127.0.0.1:8080'
}).listen('8081');

http.request({
hostname: '127.0.0.1',
port: '8081',
method: 'GET',
}, function(res) {
expect(res.statusCode).to.eql(500);

res.on('data', function (data) {
expect(data.toString()).to.eql('Internal Server Error');
});

res.on('end', function () {
proxy.close();
done();
});
}).end();
});
});
});

0 comments on commit b85aa16

Please sign in to comment.