1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-07 20:17:05 +00:00

HTTP error handlers per Party (docs and details in progress)

Former-commit-id: 7092ebed556b56d9f1769b9b23f2340c2a3a18f7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-11 00:44:54 +03:00
parent 3657aaf240
commit c039730521
18 changed files with 434 additions and 306 deletions

View File

@@ -30,8 +30,8 @@ type trieNode struct {
staticKey string
// insert data.
Handlers context.Handlers
RouteName string
Route context.RouteReadOnly
Handlers context.Handlers
}
func newTrieNode() *trieNode {
@@ -89,7 +89,9 @@ type trie struct {
hasRootWildcard bool
hasRootSlash bool
method string
statusCode int // for error codes only, method is ignored.
method string
// subdomain is empty for default-hostname routes,
// ex: mysubdomain.
subdomain string
@@ -108,7 +110,7 @@ func slowPathSplit(path string) []string {
return strings.Split(path, pathSep)[1:]
}
func (tr *trie) insert(path, routeName string, handlers context.Handlers) {
func (tr *trie) insert(path string, route context.RouteReadOnly, handlers context.Handlers) {
input := slowPathSplit(path)
n := tr.root
@@ -148,8 +150,9 @@ func (tr *trie) insert(path, routeName string, handlers context.Handlers) {
n = n.getChild(s)
}
n.RouteName = routeName
n.Route = route
n.Handlers = handlers
n.paramKeys = paramKeys
n.key = path
n.end = true
@@ -163,6 +166,8 @@ func (tr *trie) insert(path, routeName string, handlers context.Handlers) {
}
n.staticKey = path[:i]
// fmt.Printf("trie.insert: (whole path=%v) Path: %s, Route name: %s, Handlers len: %d\n", n.end, n.key, route.Name(), len(handlers))
}
func (tr *trie) search(q string, params *context.RequestParams) *trieNode {