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

Function Test_DefaultErrorHandler_WrappedFiberErrorUsesWrappedMessage

app_test.go:688–699  ·  app_test.go::Test_DefaultErrorHandler_WrappedFiberErrorUsesWrappedMessage
(t *testing.T)

Source from the content-addressed store, hash-verified

686}
687
688func Test_DefaultErrorHandler_WrappedFiberErrorUsesWrappedMessage(t *testing.T) {
689 t.Parallel()
690
691 app := New()
692 c := app.AcquireCtx(&fasthttp.RequestCtx{}).(*DefaultCtx) //nolint:errcheck,forcetypeassert // not needed
693 t.Cleanup(func() { app.ReleaseCtx(c) })
694
695 err := fmt.Errorf("auth failed: %w", ErrUnauthorized)
696 require.NoError(t, DefaultErrorHandler(c, err))
697 require.Equal(t, StatusUnauthorized, c.fasthttp.Response.StatusCode())
698 require.Equal(t, err.Error(), string(c.fasthttp.Response.Body()))
699}
700
701func Test_App_serverErrorHandler_Internal_Error(t *testing.T) {
702 t.Parallel()

Callers

nothing calls this directly

Calls 8

AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
NewFunction · 0.70
DefaultErrorHandlerFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.65
BodyMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected