mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Merge pull request #560 from meteor/fix-ws-arg-order
Fix argument order for ws stream pass
This commit is contained in:
commit
3b2178d1f7
@ -78,7 +78,7 @@ var passes = exports;
|
|||||||
*
|
*
|
||||||
* @api private
|
* @api private
|
||||||
*/
|
*/
|
||||||
function stream(req, socket, options, server, head, clb) {
|
function stream(req, socket, options, head, server, clb) {
|
||||||
common.setupSocket(socket);
|
common.setupSocket(socket);
|
||||||
|
|
||||||
if (head && head.length) socket.unshift(head);
|
if (head && head.length) socket.unshift(head);
|
||||||
|
|||||||
@ -261,9 +261,29 @@ describe('lib/http-proxy.js', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('#createProxyServer using the ws-incoming passes', function () {
|
it('should emit error on proxy error', function (done) {
|
||||||
|
var ports = { source: gen.port, proxy: gen.port };
|
||||||
|
var proxy = httpProxy.createProxyServer({
|
||||||
|
// note: we don't ever listen on this port
|
||||||
|
target: 'ws://127.0.0.1:' + ports.source,
|
||||||
|
ws: true
|
||||||
|
}),
|
||||||
|
proxyServer = proxy.listen(ports.proxy),
|
||||||
|
client = new ws('ws://127.0.0.1:' + ports.proxy);
|
||||||
|
|
||||||
|
client.on('open', function () {
|
||||||
|
client.send('hello there');
|
||||||
|
});
|
||||||
|
|
||||||
|
proxy.on('error', function (err) {
|
||||||
|
expect(err).to.be.an(Error);
|
||||||
|
expect(err.code).to.be('ECONNREFUSED');
|
||||||
|
proxyServer._server.close();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should proxy a socket.io stream', function (done) {
|
it('should proxy a socket.io stream', function (done) {
|
||||||
var ports = { source: gen.port, proxy: gen.port };
|
var ports = { source: gen.port, proxy: gen.port };
|
||||||
var proxy = httpProxy.createProxyServer({
|
var proxy = httpProxy.createProxyServer({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user