diff --git a/common.go b/common.go index 3a807dee..3fcc2e70 100644 --- a/common.go +++ b/common.go @@ -16,6 +16,7 @@ import ( "log" "math" "net/http" + "net/url" "strings" ) @@ -259,3 +260,11 @@ func JSONDecode(data []byte, to interface{}) error { return nil } + +func EncodeURLValues(url string, values url.Values) string { + path := url + if len(values) > 0 { + path += "?" + values.Encode() + } + return path +}