Browse Source

修改HttpBuildQuery

master v0.1.6
guzeng 3 years ago
parent
commit
53fc6ccc37
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      map.go
  2. +1
    -1
      map_test.go

+ 1
- 1
map.go View File

@ -112,7 +112,7 @@ func HttpBuildQuery(data map[string]string) string {
var query string var query string
for _, value := range keySlice { for _, value := range keySlice {
if data[value] != "" {
if value != "" && data[value] != "" {
query += StringJoin(value, "=", data[value], "&") query += StringJoin(value, "=", data[value], "&")
} }
} }


+ 1
- 1
map_test.go View File

@ -6,7 +6,7 @@ import (
func Test_HttpBuildQuery(t *testing.T) { func Test_HttpBuildQuery(t *testing.T) {
list := map[string]string{"a": "b", "c": "cdd", "b": ""}
list := map[string]string{"a": "b", "": "cdd", "b": ""}
ret := HttpBuildQuery(list) ret := HttpBuildQuery(list)


Loading…
Cancel
Save