Added common EncodeURLValues function.

This commit is contained in:
Adrian Gallagher
2015-10-21 10:14:34 +11:00
parent 1dfc031e3b
commit c1910bf6b6

View File

@@ -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
}