-
Notifications
You must be signed in to change notification settings - Fork 0
/
fasthttpHostRegistrar.go
43 lines (33 loc) · 1.29 KB
/
fasthttpHostRegistrar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package internal
type FasthttpHostRegistrar struct {
host *FasthttpHost
}
func NewFasthttpHostRegistrar(host *FasthttpHost) *FasthttpHostRegistrar {
return &FasthttpHostRegistrar{
host: host,
}
}
func (r *FasthttpHostRegistrar) RegisterRequestHandleModule(module RequestHandleModule) {
r.host.requestHandleService.Register(module)
}
func (r *FasthttpHostRegistrar) RegisterRouteResolveModule(module RouteResolveModule) {
r.host.requestWorker.RouteResolveService.Register(module)
}
func (r *FasthttpHostRegistrar) EnableTracer(enabled bool) {
r.host.requestTracerService.Enabled = enabled
}
func (r *FasthttpHostRegistrar) SetErrorHandler(handler ErrorHandler) {
r.host.requestWorker.ErrorHandler = handler
}
func (r *FasthttpHostRegistrar) SetRewriteHandler(handler RewriteHandler) {
r.host.requestWorker.RewriteHandler = handler
}
func (r *FasthttpHostRegistrar) SetUnhandledRequestHandler(handler RequestHandler) {
r.host.requestWorker.UnhandledRequestHandler = handler
}
func (r *FasthttpHostRegistrar) SetRequestManager(requestManager interface{}) {
r.host.requestManager = requestManager
}
func (r *FasthttpHostRegistrar) AddRoute(method string, path string, handler RequestHandler, handlerComponentID string) {
r.host.requestWorker.Router.Add(method, path, handler, handlerComponentID)
}