mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-23 13:42:25 +08:00
Merge pull request #16 from silenceper/bugfix-menu-url
json 生成不转义 &,<,<
This commit is contained in:
@@ -31,6 +31,11 @@ func PostJSON(uri string, obj interface{}) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jsonData = bytes.Replace(jsonData, []byte("\\u003c"), []byte("<"), -1)
|
||||||
|
jsonData = bytes.Replace(jsonData, []byte("\\u003e"), []byte(">"), -1)
|
||||||
|
jsonData = bytes.Replace(jsonData, []byte("\\u0026"), []byte("&"), -1)
|
||||||
|
|
||||||
body := bytes.NewBuffer(jsonData)
|
body := bytes.NewBuffer(jsonData)
|
||||||
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
response, err := http.Post(uri, "application/json;charset=utf-8", body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user