MCPcopy
hub / github.com/gofiber/fiber / Test_Request_Timeout_With_Server

Function Test_Request_Timeout_With_Server

client/request_test.go:1572–1590  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1570}
1571
1572func Test_Request_Timeout_With_Server(t *testing.T) {
1573 t.Parallel()
1574
1575 app, ln, start := createHelperServer(t)
1576 app.Get("/", func(c fiber.Ctx) error {
1577 time.Sleep(time.Millisecond * 200)
1578 return c.SendString("timeout")
1579 })
1580 go start()
1581
1582 client := New().SetDial(ln)
1583
1584 _, err := AcquireRequest().
1585 SetClient(client).
1586 SetTimeout(50 * time.Millisecond).
1587 Get("http://example.com")
1588
1589 require.Equal(t, ErrTimeoutOrCancel, err)
1590}
1591
1592func Test_Request_MaxRedirects(t *testing.T) {
1593 t.Parallel()

Callers

nothing calls this directly

Calls 8

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetClientMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
SendStringMethod · 0.65
SetDialMethod · 0.65
SetTimeoutMethod · 0.45

Tested by

no test coverage detected