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

Method customRequestHandler

router.go:454–475  ·  view source on GitHub ↗
(rctx *fasthttp.RequestCtx)

Source from the content-addressed store, hash-verified

452}
453
454func (app *App) customRequestHandler(rctx *fasthttp.RequestCtx) {
455 ctx := app.AcquireCtx(rctx)
456 defer app.ReleaseCtx(ctx)
457
458 // Check if the HTTP method is valid
459 if ctx.getMethodInt() == -1 {
460 _ = ctx.SendStatus(StatusNotImplemented) //nolint:errcheck // Always return nil
461 return
462 }
463
464 // Optional: check flash messages (hot path, see hasFlashCookie).
465 if hasFlashCookie(&ctx.Request().Header) {
466 ctx.Redirect().parseAndClearFlashMessages()
467 }
468
469 _, err := app.nextCustom(ctx)
470 if err != nil {
471 if catch := ctx.App().ErrorHandler(ctx, err); catch != nil {
472 _ = ctx.SendStatus(StatusInternalServerError) //nolint:errcheck // Always return nil
473 }
474 }
475}
476
477func (app *App) addPrefixToRoute(prefix string, route *Route, regexHandler any, customConstraints ...CustomConstraint) *Route {
478 prefixedPath := getGroupPath(prefix, route.Path)

Callers 1

defaultRequestHandlerMethod · 0.95

Calls 11

AcquireCtxMethod · 0.95
ReleaseCtxMethod · 0.95
nextCustomMethod · 0.95
hasFlashCookieFunction · 0.85
ErrorHandlerMethod · 0.80
getMethodIntMethod · 0.65
SendStatusMethod · 0.65
RequestMethod · 0.65
RedirectMethod · 0.65
AppMethod · 0.65

Tested by

no test coverage detected