MCPcopy Create free account
hub / github.com/imroc/req / TestTraceOnTimeout

Function TestTraceOnTimeout

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

Source from the content-addressed store, hash-verified

854}
855
856func TestTraceOnTimeout(t *testing.T) {
857 testWithAllTransport(t, func(t *testing.T, c *Client) {
858 c.EnableTraceAll().SetTimeout(100 * time.Millisecond)
859
860 resp, err := c.R().Get("http://req-nowhere.local")
861 tests.AssertNotNil(t, err)
862 tests.AssertNotNil(t, resp)
863
864 ti := resp.TraceInfo()
865 tests.AssertEqual(t, true, ti.DNSLookupTime >= 0)
866 tests.AssertEqual(t, true, ti.ConnectTime == 0)
867 tests.AssertEqual(t, true, ti.TLSHandshakeTime == 0)
868 tests.AssertEqual(t, true, ti.TCPConnectTime == 0)
869 tests.AssertEqual(t, true, ti.FirstResponseTime == 0)
870 tests.AssertEqual(t, true, ti.ResponseTime == 0)
871 tests.AssertEqual(t, true, ti.TotalTime > 0)
872 tests.AssertEqual(t, true, ti.TotalTime == resp.TotalTime())
873 })
874}
875
876func TestAutoDetectRequestContentType(t *testing.T) {
877 c := tc()

Callers

nothing calls this directly

Calls 9

AssertNotNilFunction · 0.92
AssertEqualFunction · 0.92
testWithAllTransportFunction · 0.85
SetTimeoutMethod · 0.80
EnableTraceAllMethod · 0.80
RMethod · 0.80
TotalTimeMethod · 0.80
GetMethod · 0.45
TraceInfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…