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

Function Test_App_serverErrorHandler_Network_Error

app_test.go:727–739  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

725}
726
727func Test_App_serverErrorHandler_Network_Error(t *testing.T) {
728 t.Parallel()
729 app := New()
730 c := app.AcquireCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck,forcetypeassert // not needed
731
732 app.serverErrorHandler(c.fasthttp, &net.DNSError{
733 Err: "test error",
734 Name: "test host",
735 IsTimeout: false,
736 })
737 require.Equal(t, string(c.fasthttp.Response.Body()), utils.StatusMessage(StatusBadGateway))
738 require.Equal(t, StatusBadGateway, c.fasthttp.Response.StatusCode())
739}
740
741func Test_App_serverErrorHandler_Unsupported_Method_Error(t *testing.T) {
742 t.Parallel()

Callers

nothing calls this directly

Calls 5

AcquireCtxMethod · 0.80
serverErrorHandlerMethod · 0.80
NewFunction · 0.70
BodyMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected