1
0
mirror of https://github.com/kataras/iris.git synced 2026-02-27 21:15:56 +00:00

New: gRPC MVC features, new WithLowercaseRouting option and add some new context methods

read HISTORY.md


Former-commit-id: 30a16cceb11f754aa32923058abeda1e736350e7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-04-25 02:30:19 +03:00
parent 0cf5d5a4a3
commit 5d3c96947c
21 changed files with 566 additions and 185 deletions

View File

@@ -14,11 +14,12 @@ import (
// If any of the following fields are changed then the
// caller should Refresh the router.
type Route struct {
Name string `json:"name"` // "userRoute"
Method string `json:"method"` // "GET"
methodBckp string // if Method changed to something else (which is possible at runtime as well, via RefreshRouter) then this field will be filled with the old one.
Subdomain string `json:"subdomain"` // "admin."
tmpl macro.Template // Tmpl().Src: "/api/user/{id:uint64}"
Name string `json:"name"` // "userRoute"
Description string `json:"description"` // "lists a user"
Method string `json:"method"` // "GET"
methodBckp string // if Method changed to something else (which is possible at runtime as well, via RefreshRouter) then this field will be filled with the old one.
Subdomain string `json:"subdomain"` // "admin."
tmpl macro.Template // Tmpl().Src: "/api/user/{id:uint64}"
// temp storage, they're appended to the Handlers on build.
// Execution happens before Handlers, can be empty.
beginHandlers context.Handlers
@@ -322,7 +323,11 @@ func (r *Route) Trace() string {
if r.Subdomain != "" {
printfmt += fmt.Sprintf(" %s", r.Subdomain)
}
printfmt += fmt.Sprintf(" %s ", r.Tmpl().Src)
printfmt += fmt.Sprintf(" %s", r.Tmpl().Src)
if r.Description != "" {
printfmt += fmt.Sprintf(" (%s)", r.Description)
}
mainHandlerName := r.MainHandlerName
if !strings.HasSuffix(mainHandlerName, ")") {
@@ -330,9 +335,9 @@ func (r *Route) Trace() string {
}
if l := r.RegisteredHandlersLen(); l > 1 {
printfmt += fmt.Sprintf("-> %s and %d more", mainHandlerName, l-1)
printfmt += fmt.Sprintf(" -> %s and %d more", mainHandlerName, l-1)
} else {
printfmt += fmt.Sprintf("-> %s", mainHandlerName)
printfmt += fmt.Sprintf(" -> %s", mainHandlerName)
}
// printfmt := fmt.Sprintf("%s: %s >> %s", r.Method, r.Subdomain+r.Tmpl().Src, r.MainHandlerName)