diff --git a/gin/request/util.go b/gin/request/util.go index e4be457..2a85013 100644 --- a/gin/request/util.go +++ b/gin/request/util.go @@ -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 }