mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] remove duplicate
This commit is contained in:
parent
83367e7e91
commit
10c0f11b68
@ -41,24 +41,6 @@ var passes = exports;
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the proper configuration for sockets,
|
|
||||||
* set no delay and set keep alive, also set
|
|
||||||
* the timeout to 0.
|
|
||||||
*
|
|
||||||
* @param {ClientRequest} Req Request object
|
|
||||||
* @param {Socket} Websocket
|
|
||||||
*
|
|
||||||
* @api private
|
|
||||||
*/
|
|
||||||
|
|
||||||
function setupSocket(req, socket) {
|
|
||||||
socket.setTimeout(0);
|
|
||||||
socket.setNoDelay(true);
|
|
||||||
|
|
||||||
socket.setKeepAlive(true, 0);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets `x-forwarded-*` headers if specified in config.
|
* Sets `x-forwarded-*` headers if specified in config.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -76,35 +76,6 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#setupSocket', function () {
|
|
||||||
it('Set the correct config to the socket', function () {
|
|
||||||
var stubSocket = {
|
|
||||||
setTimeout: function (num) {
|
|
||||||
// Simulate Socket.setTimeout()
|
|
||||||
socketConfig.timeout = num;
|
|
||||||
},
|
|
||||||
setNoDelay: function (bol) {
|
|
||||||
// Simulate Socket.setNoDelay()
|
|
||||||
socketConfig.nodelay = bol;
|
|
||||||
},
|
|
||||||
setKeepAlive: function (bol) {
|
|
||||||
// Simulate Socket.setKeepAlive()
|
|
||||||
socketConfig.keepalive = bol;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
socketConfig = {
|
|
||||||
timeout: null,
|
|
||||||
nodelay: false,
|
|
||||||
keepalive: false
|
|
||||||
},
|
|
||||||
returnValue = httpProxy.setupSocket({}, stubSocket);
|
|
||||||
expect(returnValue).to.be(undefined);
|
|
||||||
expect(socketConfig.timeout).to.eql(0);
|
|
||||||
expect(socketConfig.nodelay).to.eql(true);
|
|
||||||
expect(socketConfig.keepalive).to.eql(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#XHeaders', function () {
|
describe('#XHeaders', function () {
|
||||||
it('return if no forward request', function () {
|
it('return if no forward request', function () {
|
||||||
var returnValue = httpProxy.XHeaders({}, {}, {});
|
var returnValue = httpProxy.XHeaders({}, {}, {});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user