MCPcopy Index your code
hub / github.com/imroc/req / TestRequestDisableAutoReadResponse

Function TestRequestDisableAutoReadResponse

request_test.go:1043–1057  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1041}
1042
1043func TestRequestDisableAutoReadResponse(t *testing.T) {
1044 testWithAllTransport(t, func(t *testing.T, c *Client) {
1045 resp, err := c.R().DisableAutoReadResponse().Get("/")
1046 assertSuccess(t, resp, err)
1047 tests.AssertEqual(t, "", resp.String())
1048 result, err := resp.ToString()
1049 tests.AssertNoError(t, err)
1050 tests.AssertEqual(t, "TestGet: text response", result)
1051
1052 resp, err = c.R().DisableAutoReadResponse().Get("/")
1053 assertSuccess(t, resp, err)
1054 _, err = io.ReadAll(resp.Body)
1055 tests.AssertNoError(t, err)
1056 })
1057}
1058
1059func TestRestoreResponseBody(t *testing.T) {
1060 c := tc()

Callers

nothing calls this directly

Calls 9

AssertEqualFunction · 0.92
AssertNoErrorFunction · 0.92
testWithAllTransportFunction · 0.85
assertSuccessFunction · 0.85
RMethod · 0.80
ToStringMethod · 0.80
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…