form icon indicating copy to clipboard operation
form copied to clipboard

map[string]string encode/decode

Open RelicOfTesla opened this issue 6 years ago • 1 comments

fv, _ := form.NewEncoder().Encode(map[string]string{"a": "b"})
fmt.Printf(`the str="%s"`+"\n", fv.Encode())
the str="%5Ba%5D=b"

i will httpPost(xxx, encodeIt(x))

RelicOfTesla avatar Mar 18 '20 09:03 RelicOfTesla

strmap := map[string]string{}
form.NewDecoder().Decode(&strmap, url.Values{"a": []string{"b"}})   // FormValue <= http://xx.com/?a=b
fmt.Println(strmap)

RelicOfTesla avatar Mar 18 '20 10:03 RelicOfTesla