Start the middleware according to the configuration
(enable bool, cmdList []string)
| 27 | |
| 28 | // Start the middleware according to the configuration |
| 29 | func IgnoreCMDMiddleware(enable bool, cmdList []string) HandlerFunc { |
| 30 | return func(context *Context) error { |
| 31 | // Ignore custom commands |
| 32 | if enable && len(cmdList) > 0 { |
| 33 | if utils.InArray(context.Cmd, cmdList) { |
| 34 | return fmt.Errorf(ErrUnknownCommand, context.Cmd) |
| 35 | } |
| 36 | } |
| 37 | return context.Next() |
| 38 | } |
| 39 | } |