Files
golang-tests/single_file_tests/url.go
2020-02-10 00:06:14 +08:00

18 lines
307 B
Go

package main
import (
"fmt"
"strings"
"net/url"
)
func main() {
q := url.Values{}
q.Add("b", "testing")
q.Add("a", "hello world")
// url.Values will sort keys(alphabet asc)
// and encode ' '(blank) to '+', SHOULD replace to '%20'
s := strings.ReplaceAll(q.Encode(), "+", "%20")
fmt.Println(s)
}