提交http格式不对,出现dump问题

This commit is contained in:
duanhf2012
2020-02-24 10:58:40 +08:00
parent af9c518806
commit 77ca48dcc0

View File

@@ -33,7 +33,7 @@ type HttpRequest struct {
Header http.Header
Body string
ParamStr string
ParamStr string //http://127.0.0.1:7001/aaa/bbb?aa=1中的aa=1部分
mapParam map[string]string
URL string
//Req http.Request
@@ -117,7 +117,9 @@ func (slf *HttpRequest) Query(key string) (string, bool) {
paramStrList := strings.Split(slf.ParamStr, "&")
for _, val := range paramStrList {
Index := strings.Index(val, "=")
slf.mapParam[val[0:Index]] = val[Index+1:]
if Index >= 0 {
slf.mapParam[val[0:Index]] = val[Index+1:]
}
}
}