Browse Source

修改HttpBuildStringQuery方法

master v0.2.0
wuyongyuan 3 years ago
parent
commit
a2aaf6a7b9
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      map.go

+ 3
- 2
map.go View File

@ -2,6 +2,7 @@ package helper
import ( import (
"errors" "errors"
"net/url"
"sort" "sort"
"strings" "strings"
) )
@ -121,7 +122,7 @@ func HttpBuildQuery(data map[string]string) string {
} }
/** /**
* 对map进行拼接
* 对map字典按照顺序进行拼接并且把每个value进行类urlencode
* @param data map[string]string * @param data map[string]string
* @2021/10/14 * @2021/10/14
* @wyy * @wyy
@ -139,7 +140,7 @@ func HttpBuildStringQuery(data map[string]string) string {
for _, value := range keySlice { for _, value := range keySlice {
if value != "" && data[value] != "" { if value != "" && data[value] != "" {
query += StringJoin(value, "=", data[value], "&")
query += StringJoin(value, "=", url.QueryEscape(data[value]), "&")
} }
} }


Loading…
Cancel
Save