Modify the call of JSONMarshal in the unit test

This commit is contained in:
Sun XingBo 2021-07-22 13:14:01 +08:00 committed by GitHub
parent efd710a652
commit d6f939ac09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,12 +437,12 @@ func TestBeegoHTTPRequestXMLBody(t *testing.T) {
func TestBeegoHTTPRequestResponseForValue(t *testing.T) { func TestBeegoHTTPRequestResponseForValue(t *testing.T) {
} }
func TestBeegoHTTPRequestMarshal(t *testing.T) { func TestBeegoHTTPRequestJSONMarshal(t *testing.T) {
req := Post("http://beego.me") req := Post("http://beego.me")
req.SetEscapeHTML(false) req.SetEscapeHTML(false)
body := map[string]interface{} { body := map[string]interface{} {
"escape": "left&right", "escape": "left&right",
} }
b, _ := req.Marshal(body) b, _ := req.JSONMarshal(body)
assert.Equal(t,fmt.Sprintf(`{"escape":"left&right"}%s`, "\n"), string(b)) assert.Equal(t,fmt.Sprintf(`{"escape":"left&right"}%s`, "\n"), string(b))
} }