| 425 | } |
| 426 | |
| 427 | func (app *App) defaultRequestHandler(rctx *fasthttp.RequestCtx) { |
| 428 | ctx, ok := app.acquireDefaultCtx(rctx) |
| 429 | if !ok { |
| 430 | app.customRequestHandler(rctx) |
| 431 | return |
| 432 | } |
| 433 | defer app.releaseDefaultCtx(ctx) |
| 434 | |
| 435 | // Check if the HTTP method is valid |
| 436 | if ctx.methodInt == -1 { |
| 437 | _ = ctx.SendStatus(StatusNotImplemented) //nolint:errcheck // Always return nil |
| 438 | return |
| 439 | } |
| 440 | |
| 441 | // Optional: check flash messages (hot path, see hasFlashCookie). |
| 442 | if hasFlashCookie(&ctx.fasthttp.Request.Header) { |
| 443 | ctx.Redirect().parseAndClearFlashMessages() |
| 444 | } |
| 445 | |
| 446 | _, err := app.next(ctx) |
| 447 | if err != nil { |
| 448 | if catch := ctx.App().ErrorHandler(ctx, err); catch != nil { |
| 449 | _ = ctx.SendStatus(StatusInternalServerError) //nolint:errcheck // Always return nil |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | func (app *App) customRequestHandler(rctx *fasthttp.RequestCtx) { |
| 455 | ctx := app.AcquireCtx(rctx) |