NextOr checks if chain has a next handler, if so then it executes it otherwise it sets a new chain assigned to this Context based on the given handler(s) and executes its first handler. Returns true if next handler exists and executed, otherwise false. Note that if no next handler found and handle
(handlers ...Handler)
| 693 | // Note that if no next handler found and handlers are missing then |
| 694 | // it sends a Status Not Found (404) to the client and it stops the execution. |
| 695 | func (ctx *Context) NextOr(handlers ...Handler) bool { |
| 696 | if next := ctx.NextHandler(); next != nil { |
| 697 | ctx.Skip() // skip this handler from the chain. |
| 698 | next(ctx) |
| 699 | return true |
| 700 | } |
| 701 | |
| 702 | if len(handlers) == 0 { |
| 703 | ctx.NotFound() |
| 704 | ctx.StopExecution() |
| 705 | return false |
| 706 | } |
| 707 | |
| 708 | ctx.Do(handlers) |
| 709 | |
| 710 | return false |
| 711 | } |
| 712 | |
| 713 | // NextOrNotFound checks if chain has a next handler, if so then it executes it |
| 714 | // otherwise it sends a Status Not Found (404) to the client and stops the execution. |
no test coverage detected