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

Function testRequestFail

client/helper_test.go:117–139  ·  view source on GitHub ↗
(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Request), excepted error, count ...int)

Source from the content-addressed store, hash-verified

115}
116
117func 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
141func testClient(t *testing.T, handler fiber.Handler, wrapAgent func(agent *Client), excepted string, count ...int) { //nolint:unparam // maybe needed
142 t.Helper()

Callers 1

Calls 7

createHelperServerFunction · 0.85
AcquireRequestFunction · 0.85
SetClientMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
SetDialMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected