mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[test] test onError part, proxying to no where
This commit is contained in:
parent
27df8d72ad
commit
b85aa16e75
@ -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://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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user