(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Client), excepted string, count ...int)
| 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() |
| 143 | |
| 144 | app, ln, start := createHelperServer(t) |
| 145 | app.Get("/", handler) |
| 146 | go start() |
| 147 | |
| 148 | c := 1 |
| 149 | if len(count) > 0 { |
| 150 | c = count[0] |
| 151 | } |
| 152 | |
| 153 | for i := 0; i < c; i++ { |
| 154 | client := New().SetDial(ln) |
| 155 | wrapAgent(client) |
| 156 | |
| 157 | resp, err := client.Get("http://example.com") |
| 158 | |
| 159 | require.NoError(t, err) |
| 160 | require.Equal(t, fiber.StatusOK, resp.StatusCode()) |
| 161 | require.Equal(t, excepted, resp.String()) |
| 162 | resp.Close() |
| 163 | } |
| 164 | } |
no test coverage detected