...
|
...
|
@@ -68,9 +68,8 @@ module.exports = function(proxyRoute) { |
|
|
options.headers['Referer'] = req.headers['referer'];
|
|
|
}
|
|
|
|
|
|
if(isFromArray(req.body)) {
|
|
|
options.method = "GET";
|
|
|
options.url += "?"+ queryString.stringify(req.body);
|
|
|
if(isFromArray(req.body)) { //如果是数组的form表单,使用querystring序列化
|
|
|
options.useQuerystring = true;
|
|
|
}
|
|
|
|
|
|
//如果是POST,设置form表单的传参
|
...
|
...
|
@@ -81,10 +80,10 @@ module.exports = function(proxyRoute) { |
|
|
logger.log('info','grayroute: request options: %j',options,{});
|
|
|
|
|
|
//发起代理请求
|
|
|
if(req.is('html')) { //如果是静态资源
|
|
|
if(req.is('html')) {
|
|
|
request(options,callback);
|
|
|
} else {
|
|
|
request(options).pipe(ress);
|
|
|
request(options).pipe(ress);//如果是静态资源,直接管道传递结果
|
|
|
}
|
|
|
|
|
|
//代理回调
|
...
|
...
|
@@ -146,6 +145,11 @@ module.exports = function(proxyRoute) { |
|
|
return cookie;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断是否是数组的form表单
|
|
|
* @param {[type]} form [description]
|
|
|
* @return {Boolean} [description]
|
|
|
*/
|
|
|
function isFromArray(form) {
|
|
|
form = form||{};
|
|
|
var ret = false;
|
...
|
...
|
|