1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-23 03:45:56 +00:00

Make ExecRouteAgainst to work better and fix gorillamux and httprouter, remove of contextlinker policy it's useless now

Former-commit-id: 8d3501e6c490d630d3a4bec0c077dcd7d532242f
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-18 07:03:37 +02:00
parent ab63ebcfa5
commit 7263649002
10 changed files with 194 additions and 99 deletions

10
iris.go
View File

@@ -340,6 +340,16 @@ func New(setters ...OptionSetter) *Framework {
if routerBuilder != nil {
// buid the router using user's selection build policy
s.Router.build(routerBuilder)
s.Router.repository.OnMethodChanged(func(route RouteInfo, oldMethod string) {
// set service not available temporarily until the router completes the building
// this won't take more than 100ms, but we want to inform the user.
s.Router.handler = ToNativeHandler(s, HandlerFunc(func(ctx *Context) {
ctx.EmitError(StatusServiceUnavailable)
}))
// Re-build the whole router if state changed (from offline to online state mostly)
s.Router.build(routerBuilder)
})
}
}
}})