(t *testing.T)
| 874 | } |
| 875 | |
| 876 | func TestAutoDetectRequestContentType(t *testing.T) { |
| 877 | c := tc() |
| 878 | resp, err := c.R().SetBody(getTestFileContent(t, "sample-image.png")).Post("/content-type") |
| 879 | assertSuccess(t, resp, err) |
| 880 | tests.AssertEqual(t, "image/png", resp.String()) |
| 881 | |
| 882 | resp, err = c.R().SetBodyJsonString(`{"msg": "test"}`).Post("/content-type") |
| 883 | assertSuccess(t, resp, err) |
| 884 | tests.AssertEqual(t, header.JsonContentType, resp.String()) |
| 885 | |
| 886 | resp, err = c.R().SetContentType(header.XmlContentType).SetBody(`{"msg": "test"}`).Post("/content-type") |
| 887 | assertSuccess(t, resp, err) |
| 888 | tests.AssertEqual(t, header.XmlContentType, resp.String()) |
| 889 | |
| 890 | resp, err = c.R().SetBody(`<html><body><h1>hello</h1></body></html>`).Post("/content-type") |
| 891 | assertSuccess(t, resp, err) |
| 892 | tests.AssertEqual(t, "text/html; charset=utf-8", resp.String()) |
| 893 | |
| 894 | resp, err = c.R().SetBody(`hello world`).Post("/content-type") |
| 895 | assertSuccess(t, resp, err) |
| 896 | tests.AssertEqual(t, header.PlainTextContentType, resp.String()) |
| 897 | } |
| 898 | |
| 899 | func TestSetFileUploadCheck(t *testing.T) { |
| 900 | c := tc() |
nothing calls this directly
no test coverage detected
searching dependent graphs…