Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-portal-fe
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
周奇琪
9 years ago
Commit
146c98948a361d7b1627adc77873777cd2e947d0
1 parent
3fe77fa9
master
...
feature/feature_v4.5_20160525
feature/feature_v4.6_20160525
yohobuy_portal_dev_v4.4_20160525
yohobuy_portal_dev_v4.5_20160601
yohobuy_portal_dev_v4.6_20160601
yohobuy_portal_dev_v4.7_20160616
4.4.0_20160531
4.3.6_20160517
4.3.3_20160512
4.3.2_20160511
4.3.1_20160509
1.5
yohobuy_portal_dev_v4.6_20160622
grayProxy
fixed_gray_import
delAuthValidate
changeClientVersion
如果是数组的form数据,使用querystring提交
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
server/mid/grayroute.js
server/package.json
server/mid/grayroute.js
View file @
146c989
...
...
@@ -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
;
...
...
server/package.json
View file @
146c989
...
...
@@ -12,7 +12,6 @@
"handlebars-layouts"
:
"^3.1.3"
,
"ipaddr.js"
:
"^1.1.0"
,
"lodash"
:
"^3.10.0"
,
"query-string"
:
"^3.0.1"
,
"request"
:
"^2.55.0"
,
"yo.js"
:
"^1.1.3"
},
...
...
Please
register
or
login
to post a comment