Skip to content

Commit 105eca4

Browse files
committed
Merge pull request astaxie#34 from buaazp/fix_param_parse
Fixed wrong order of params parsing
2 parents a400e01 + bb1795d commit 105eca4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

http.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ func getHTTP(method string, url string, args []string) (r *httplib.BeegoHttpRequ
5858
jsonmap[strs[0]] = toRealType(strs[1])
5959
continue
6060
}
61-
// Headers
62-
strs = strings.Split(args[i], ":")
63-
if len(strs) >= 2 {
64-
if strs[0] == "Host" {
65-
r.SetHost(strings.Join(strs[1:], ":"))
66-
}
67-
r.Header(strs[0], strings.Join(strs[1:], ":"))
68-
continue
69-
}
7061
// Params
7162
strs = strings.Split(args[i], "=")
7263
if len(strs) == 2 {
@@ -97,6 +88,15 @@ func getHTTP(method string, url string, args []string) (r *httplib.BeegoHttpRequ
9788
r.PostFile(strs[0], strs[1])
9889
continue
9990
}
91+
// Headers
92+
strs = strings.Split(args[i], ":")
93+
if len(strs) >= 2 {
94+
if strs[0] == "Host" {
95+
r.SetHost(strings.Join(strs[1:], ":"))
96+
}
97+
r.Header(strs[0], strings.Join(strs[1:], ":"))
98+
continue
99+
}
100100
}
101101
if !form && len(jsonmap) > 0 {
102102
r.JsonBody(jsonmap)

0 commit comments

Comments
 (0)