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

Method buildHandler

core/router/handler_execution_rules.go:71–86  ·  view source on GitHub ↗
(h context.Handler)

Source from the content-addressed store, hash-verified

69}
70
71func (e ExecutionOptions) buildHandler(h context.Handler) context.Handler {
72 if !e.Force {
73 return h
74 }
75
76 return func(ctx *context.Context) {
77 // Proceed will fire the handler and return false here if it doesn't contain a `ctx.Next()`,
78 // so we add the `ctx.Next()` wherever is necessary in order to eliminate any dev's misuse.
79 //
80 // 26 Feb 2022: check if manually stopped, and if it's then don't call ctx.Next.
81 if hasStopped, hasNext := ctx.ProceedAndReportIfStopped(h); !hasStopped && !hasNext {
82 // `ctx.Next()` always checks for `ctx.IsStopped()` and handler(s) positions by-design.
83 ctx.Next()
84 }
85 }
86}
87
88func (e ExecutionOptions) apply(handlers *context.Handlers) bool {
89 if !e.Force {

Callers 2

applyMethod · 0.95
applyExecutionRulesFunction · 0.80

Calls 2

NextMethod · 0.80

Tested by

no test coverage detected