mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] tests
This commit is contained in:
parent
16eacfa961
commit
a255f984fe
341
cov/coverage.html
Normal file
341
cov/coverage.html
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
var http = require('http'),
|
var http = require('http'),
|
||||||
https = require('https'),
|
https = require('https'),
|
||||||
url = require('url'),
|
url = require('url'),
|
||||||
caronte = require('./caronte'),
|
caronte = require('./caronte/'),
|
||||||
events = require('eventemitter2'),
|
events = require('eventemitter2'),
|
||||||
proxy = exports;
|
proxy = exports;
|
||||||
|
|
||||||
@ -40,6 +40,7 @@ proxy.createProxyServer = function createProxyServer(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
['target', 'forward'].forEach(function(key) {
|
['target', 'forward'].forEach(function(key) {
|
||||||
|
if(!options[key]) return;
|
||||||
options[key] = url.parse(options[key]);
|
options[key] = url.parse(options[key]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ function deleteLength(req, res, options) {
|
|||||||
if(req.method === 'DELETE' && !req.headers['content-length']) {
|
if(req.method === 'DELETE' && !req.headers['content-length']) {
|
||||||
req.headers['content-length'] = '0';
|
req.headers['content-length'] = '0';
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets timeout in request socket if it was specified in options.
|
* Sets timeout in request socket if it was specified in options.
|
||||||
@ -42,7 +42,7 @@ function timeout(req, res, options) {
|
|||||||
if(options.timeout) {
|
if(options.timeout) {
|
||||||
req.socket.setTimeout(options.timeout);
|
req.socket.setTimeout(options.timeout);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets `x-forwarded-*` headers if specified in config.
|
* Sets `x-forwarded-*` headers if specified in config.
|
||||||
@ -69,7 +69,7 @@ function XHeaders(req, res, options) {
|
|||||||
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
||||||
values[header]
|
values[header]
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the actual proxying. If `forward` is enabled fires up
|
* Does the actual proxying. If `forward` is enabled fires up
|
||||||
|
|||||||
1
lib/caronte/passes/ws.js
Normal file
1
lib/caronte/passes/ws.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// ws
|
||||||
@ -42,7 +42,7 @@ function ForwardStream() {
|
|||||||
|
|
||||||
ForwardStream.prototype.onPipe = function(request) {
|
ForwardStream.prototype.onPipe = function(request) {
|
||||||
this.forwardReq = (options.ssl ? https : http).request(
|
this.forwardReq = (options.ssl ? https : http).request(
|
||||||
common.setupOutgoing(options.ssl || {}, options, request);
|
common.setupOutgoing(options.ssl || {}, options, request)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user