mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[api] Expose adapted version of stack so it can be used with HttpProxy instances not created by httpProxy.createServer()
This commit is contained in:
parent
be3a0d84a1
commit
5d6e6b9f78
@ -115,10 +115,10 @@ exports.setMaxSockets = function (value) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// stack
|
// ### function stack (middlewares, proxy)
|
||||||
// adapted from https://github.com/creationix/stack
|
// adapted from https://github.com/creationix/stack
|
||||||
//
|
//
|
||||||
function stack (middlewares, proxy) {
|
exports.stack = function stack (middlewares, proxy) {
|
||||||
var handle;
|
var handle;
|
||||||
middlewares.reverse().forEach(function (layer) {
|
middlewares.reverse().forEach(function (layer) {
|
||||||
var child = handle;
|
var child = handle;
|
||||||
@ -206,7 +206,7 @@ exports.createServer = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (middleware.length > 1) {
|
if (middleware.length > 1) {
|
||||||
handler = callback = stack(middleware, proxy);
|
handler = callback = exports.stack(middleware, proxy);
|
||||||
}
|
}
|
||||||
else if (middleware.length) {
|
else if (middleware.length) {
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user