1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

minor fix required for the upcoming release

Former-commit-id: f04b770f93d7612941340af6e45d7d0516035e14
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-20 05:46:23 +02:00
parent 08403f0317
commit 027eb5d6da
5 changed files with 66 additions and 30 deletions

View File

@@ -28,6 +28,8 @@ func newApp() *iris.Application {
})
// Different path parameters types in the same path.
// Note that: fallback should registered first e.g. {path} {string},
// because the handler on this case is executing from last to top.
app.Get("/u/{p:path}", func(ctx iris.Context) {
ctx.Writef(":string, :int, :uint, :alphabetical and :path in the same path pattern.")
})
@@ -39,6 +41,13 @@ func newApp() *iris.Application {
ctx.Writef("username (string): %s", ctx.Params().Get("username"))
})
app.Get("/u/{firstname:alphabetical}", func(ctx iris.Context) {
ctx.Writef("before firstname (alphabetical), current route name: %s\n", ctx.RouteName())
ctx.Next()
}, func(ctx iris.Context) {
ctx.Writef("firstname (alphabetical): %s", ctx.Params().Get("firstname"))
})
app.Get("/u/{id:int}", func(ctx iris.Context) {
ctx.Writef("before id (int), current route name: %s\n", ctx.RouteName())
ctx.Next()
@@ -53,13 +62,6 @@ func newApp() *iris.Application {
ctx.Writef("uid (uint): %d", ctx.Params().GetUintDefault("uid", 0))
})
app.Get("/u/{firstname:alphabetical}", func(ctx iris.Context) {
ctx.Writef("before firstname (alphabetical), current route name: %s\n", ctx.RouteName())
ctx.Next()
}, func(ctx iris.Context) {
ctx.Writef("firstname (alphabetical): %s", ctx.Params().Get("firstname"))
})
/*
/u/some/path/here maps to :path
/u/abcd maps to :alphabetical (if :alphabetical registered otherwise :string)