Skip to content

Commit b85aa16

Browse files
committed
[test] test onError part, proxying to no where
1 parent 27df8d7 commit b85aa16

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/lib-caronte-streams-proxy-test.js

+25
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,29 @@ describe('lib/caronte/streams/proxy.js', function () {
8181
}).end();
8282
});
8383
});
84+
85+
describe('caronte createProxyServer() method with error response', function () {
86+
it('should make the request and response with error', function(done) {
87+
var proxy = caronte.createProxyServer({
88+
target: 'http://127.0.0.1:8080'
89+
}).listen('8081');
90+
91+
http.request({
92+
hostname: '127.0.0.1',
93+
port: '8081',
94+
method: 'GET',
95+
}, function(res) {
96+
expect(res.statusCode).to.eql(500);
97+
98+
res.on('data', function (data) {
99+
expect(data.toString()).to.eql('Internal Server Error');
100+
});
101+
102+
res.on('end', function () {
103+
proxy.close();
104+
done();
105+
});
106+
}).end();
107+
});
108+
});
84109
});

0 commit comments

Comments
 (0)