Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interceptor ¶
type Interceptor interface { // higher prior Priority() int Intercept(ctx *common.RequestCtx) (InterceptorAction, interface{}) }
type InterceptorAction ¶
type InterceptorAction int
const ( // call next interceptor Routine // returned value must be nil Continue InterceptorAction // block the request, // returned value can be assigned by the second parameter Block // skip other interceptors, enter normal handler, not recommended // returned value must be nil Skip )
type InterceptorChain ¶
func NewInterceptorChain ¶
func NewInterceptorChain() *InterceptorChain
func (*InterceptorChain) AddInterceptor ¶
func (r *InterceptorChain) AddInterceptor(interceptor Interceptor)
func (*InterceptorChain) CallInterceptors ¶
func (r *InterceptorChain) CallInterceptors(ctx *common.RequestCtx) (bool, interface{})
interceptor chain returns a bool tell if the request should be blocked or resumed second parameter will be treat as the response body
Click to show internal directories.
Click to hide internal directories.