(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Request), excepted error, count ...int)
| 115 | } |
| 116 | |
| 117 | func testRequestFail(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Request), excepted error, count ...int) { |
| 118 | t.Helper() |
| 119 | |
| 120 | app, ln, start := createHelperServer(t) |
| 121 | app.Get("/", handler) |
| 122 | go start() |
| 123 | |
| 124 | c := 1 |
| 125 | if len(count) > 0 { |
| 126 | c = count[0] |
| 127 | } |
| 128 | |
| 129 | client := New().SetDial(ln) |
| 130 | |
| 131 | for i := 0; i < c; i++ { |
| 132 | req := AcquireRequest().SetClient(client) |
| 133 | wrapAgent(req) |
| 134 | |
| 135 | _, err := req.Get("http://example.com") |
| 136 | |
| 137 | require.Equal(t, excepted.Error(), err.Error()) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func testClient(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Client), excepted string, count ...int) { //nolint:unparam // maybe needed |
| 142 | t.Helper() |
no test coverage detected