MCPcopy
hub / github.com/gin-gonic/gin / PerformRequest

Function PerformRequest

routes_test.go:25–33  ·  view source on GitHub ↗

PerformRequest for testing gin router.

(r http.Handler, method, path string, headers ...header)

Source from the content-addressed store, hash-verified

23
24// PerformRequest for testing gin router.
25func PerformRequest(r http.Handler, method, path string, headers ...header) *httptest.ResponseRecorder {
26 req := httptest.NewRequest(method, path, nil)
27 for _, h := range headers {
28 req.Header.Add(h.Key, h.Value)
29 }
30 w := httptest.NewRecorder()
31 r.ServeHTTP(w, req)
32 return w
33}
34
35func testRouteOK(method string, t *testing.T) {
36 passed := false

Callers 15

TestMiddlewareNoRouteFunction · 0.85
TestMiddlewareAbortFunction · 0.85
TestMiddlewareWriteFunction · 0.85
TestPanicCleanFunction · 0.85
TestPanicInHandlerFunction · 0.85
TestPanicWithAbortFunction · 0.85
TestPanicWithBrokenPipeFunction · 0.85

Calls 1

ServeHTTPMethod · 0.45

Tested by

no test coverage detected