resty
resty copied to clipboard
Resty can't handle Chinese character
Can resty support custom encoding?
When you are creating an issue on any kind of programming website, make sure you spend a little more of your precious time to explain what your problem is and make an effort to give example cases and code blocks.
On to the subject at hand:
GET
GOLANG
resp, err := resty.New().R().Get("https://postman-echo.com/get?foo=" + url.QueryEscape("世界"))
CURL
curl -G -H "Accept-Charset: utf-8" https://postman-echo.com/get --data-urlencode "foo=世界" | jq
POST
GOLANG
resp, err := resty.New().R().SetBody("{foo: \"世界\"}").Post("https://postman-echo.com/post")
CURL
curl -X POST -H "Accept-Charset: utf-8" -H "Content-Type: application/json" https://postman-echo.com/post -d "{foo: 世界}"
From the looks of it I think you demand the client to automatically urlencode your query parameters.