MCPcopy Create free account
hub / github.com/kataras/iris / NextOr

Method NextOr

context/context.go:695–711  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
695func (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.

Callers 1

NextOrNotFoundMethod · 0.95

Calls 5

NextHandlerMethod · 0.95
SkipMethod · 0.95
NotFoundMethod · 0.95
StopExecutionMethod · 0.95
DoMethod · 0.95

Tested by

no test coverage detected