增加解析get请求方法
This commit is contained in:
parent
f4480dfb62
commit
635028350e
@ -57,6 +57,17 @@ func ParseGetRequestURI(url *url.URL) map[string][]string {
|
||||
// Author : zhangdeman001@ke.com<白茶清欢>
|
||||
//
|
||||
// Date : 9:07 下午 2021/7/24
|
||||
func ParseGetRequestBody(ctx *gin.Context) {
|
||||
|
||||
func ParseGetRequestBody(ctx *gin.Context) map[string]string {
|
||||
result := make(map[string]string)
|
||||
urlRaw := strings.TrimLeft(ctx.Request.URL.RawQuery, "/")
|
||||
queryArr := strings.Split(urlRaw, "&")
|
||||
for _, itemPair := range queryArr {
|
||||
itemPairArr := strings.Split(itemPair, "=")
|
||||
if len(itemPairArr) == 1 {
|
||||
result[itemPairArr[0]] = ""
|
||||
} else {
|
||||
result[itemPairArr[0]] = strings.Join(itemPairArr[1:], "=")
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user