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

Function Test_App_serverErrorHandler_Internal_Error

app_test.go:701–710  ·  app_test.go::Test_App_serverErrorHandler_Internal_Error
(t *testing.T)

Source from the content-addressed store, hash-verified

699}
700
701func Test_App_serverErrorHandler_Internal_Error(t *testing.T) {
702 t.Parallel()
703 app := New()
704 msg := "test err"
705 c := app.AcquireCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck,forcetypeassert // not needed
706
707 app.serverErrorHandler(c.fasthttp, errors.New(msg))
708 require.Equal(t, string(c.fasthttp.Response.Body()), msg)
709 require.Equal(t, StatusBadRequest, c.fasthttp.Response.StatusCode())
710}
711
712func Test_App_serverErrorHandler_TypedNilOpError(t *testing.T) {
713 t.Parallel()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected