Method defines a method and the Handler it is bind to. By default "ReturnMethod" handling is used.
| 48 | // Method defines a method and the Handler it is bind to. By default |
| 49 | // "ReturnMethod" handling is used. |
| 50 | type Method struct { |
| 51 | // name is the method name. Unnamed methods can exist |
| 52 | name string |
| 53 | |
| 54 | // handler contains the related Handler for the given method |
| 55 | handler Handler // handler is the base handler, the response of it is returned as the final |
| 56 | preHandlers []Handler // a list of handlers that are executed before the main handler |
| 57 | postHandlers []Handler // a list of handlers that are executed after the main handler |
| 58 | finalFuncs []FinalFunc // a list of final funcs executed upon returning from ServeKite |
| 59 | |
| 60 | // authenticate defines if a given authenticator function is enabled for |
| 61 | // the given auth type in the request. |
| 62 | authenticate bool |
| 63 | |
| 64 | // handling defines how to handle chaining of kite.Handler middlewares. |
| 65 | handling MethodHandling |
| 66 | |
| 67 | // initialized is used to indicate whether all pre and post handlers are |
| 68 | // initialized. |
| 69 | initialized bool |
| 70 | |
| 71 | // bucket is used for throttling the method by certain rule |
| 72 | bucket *ratelimit.Bucket |
| 73 | |
| 74 | mu sync.Mutex // protects handler slices |
| 75 | } |
| 76 | |
| 77 | // addHandle is an internal method to add a handler |
| 78 | func (k *Kite) addHandle(method string, handler Handler) *Method { |
nothing calls this directly
no outgoing calls
no test coverage detected