Documentation
¶
Overview ¶
Package hook provides observation points for framework lifecycle events. Unlike plugins, hooks observe framework behaviour without extending it.
Index ¶
- type Hooks
- func (reg *Hooks) AddOnError(f OnErrorFunc)
- func (reg *Hooks) AddOnRequest(f OnRequestFunc)
- func (reg *Hooks) AddOnRespond(f OnRespondFunc)
- func (reg *Hooks) Inject(r *http.Request) *http.Request
- func (reg *Hooks) NotifyError(r *http.Request, err error)
- func (reg *Hooks) NotifyRequest(r *http.Request)
- func (reg *Hooks) NotifyRespond(r *http.Request, statusCode int)
- type OnErrorFunc
- type OnRequestFunc
- type OnRespondFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks holds all registered hooks for each observation point.
func (*Hooks) AddOnError ¶
func (reg *Hooks) AddOnError(f OnErrorFunc)
AddOnError registers a hook that fires when HandleError is called.
func (*Hooks) AddOnRequest ¶
func (reg *Hooks) AddOnRequest(f OnRequestFunc)
AddOnRequest registers a hook that fires on every incoming request.
func (*Hooks) AddOnRespond ¶
func (reg *Hooks) AddOnRespond(f OnRespondFunc)
AddOnRespond registers a hook that fires when Respond is called.
func (*Hooks) NotifyError ¶
NotifyError calls all registered OnError hooks.
func (*Hooks) NotifyRequest ¶
NotifyRequest calls all registered OnRequest hooks.
type OnErrorFunc ¶
OnErrorFunc is called when HandleError writes an error response.
type OnRequestFunc ¶
OnRequestFunc is called when an incoming request is received, before dispatch.
type OnRespondFunc ¶
OnRespondFunc is called when Respond writes a successful response.