add url
This commit is contained in:
18
single_file_tests/url.go
Normal file
18
single_file_tests/url.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user