mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +00:00
Add a TODO on the latest HISTORY.md entry
Also disable version updater on Iris benchmark source code files. It may runs ever faster than before if you started the benchmarks immediately after the banner 👍
Former-commit-id: a55dc1e0b658d7386229c32ba6953b1ea60f2872
This commit is contained in:
@@ -183,8 +183,8 @@ func (api *APIBuilder) Handle(method string, relativePath string, handlers ...co
|
||||
// app.HandleMany(iris.MethodGet, "/user /user/{id:int} /user/me", userHandler)
|
||||
// At the other side, with `Handle` we've had to write:
|
||||
// app.Handle(iris.MethodGet, "/user", userHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/{id:int}", userByIDHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/me", userMeHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/{id:int}", userHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/me", userHandler)
|
||||
//
|
||||
// This method is used behind the scenes at the `Controller` function
|
||||
// in order to handle more than one paths for the same controller instance.
|
||||
|
||||
@@ -62,8 +62,8 @@ type Party interface {
|
||||
// app.HandleMany(iris.MethodGet, "/user /user/{id:int} /user/me", userHandler)
|
||||
// At the other side, with `Handle` we've had to write:
|
||||
// app.Handle(iris.MethodGet, "/user", userHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/{id:int}", userByIDHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/me", userMeHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/{id:int}", userHandler)
|
||||
// app.Handle(iris.MethodGet, "/user/me", userHandler)
|
||||
//
|
||||
// This method is used behind the scenes at the `Controller` function
|
||||
// in order to handle more than one paths for the same controller instance.
|
||||
|
||||
@@ -165,6 +165,24 @@ func formatPath(path string) string {
|
||||
return path
|
||||
}
|
||||
|
||||
// StaticPath returns the static part of the original, registered route path.
|
||||
// if /user/{id} it will return /user
|
||||
// if /user/{id}/friend/{friendid:int} it will return /user too
|
||||
// if /assets/{filepath:path} it will return /assets.
|
||||
func (r Route) StaticPath() string {
|
||||
src := r.tmpl.Src
|
||||
bidx := strings.IndexByte(src, '{')
|
||||
if bidx == -1 || len(src) <= bidx {
|
||||
return src // no dynamic part found
|
||||
}
|
||||
if bidx == 0 { // found at first index,
|
||||
// but never happens because of the prepended slash
|
||||
return "/"
|
||||
}
|
||||
|
||||
return src[:bidx]
|
||||
}
|
||||
|
||||
// ResolvePath returns the formatted path's %v replaced with the args.
|
||||
func (r Route) ResolvePath(args ...string) string {
|
||||
rpath, formattedPath := r.Path, r.FormattedPath
|
||||
|
||||
Reference in New Issue
Block a user