mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 05:26:26 +01:00
format the prev
Former-commit-id: 4d203295b1daa1091a45de8ce683af0e6b47365b
This commit is contained in:
parent
b3bc30c5af
commit
7b94a4666c
|
@ -190,7 +190,7 @@ latLonRegex, _ := regexp.Compile(latLonExpr)
|
||||||
// MatchString is a type of func(string) bool, so we use it as it is.
|
// MatchString is a type of func(string) bool, so we use it as it is.
|
||||||
app.Macros().String.RegisterFunc("coordinate", latLonRegex.MatchString)
|
app.Macros().String.RegisterFunc("coordinate", latLonRegex.MatchString)
|
||||||
|
|
||||||
app.Get("/coordinates/{lat:string coordinate() else 400}/{lon:string coordinate() else 400}", func(ctx iris.Context) {
|
app.Get("/coordinates/{lat:string coordinate()}/{lon:string coordinate()}", func(ctx iris.Context) {
|
||||||
ctx.Writef("Lat: %s | Lon: %s", ctx.Params().Get("lat"), ctx.Params().Get("lon"))
|
ctx.Writef("Lat: %s | Lon: %s", ctx.Params().Get("lat"), ctx.Params().Get("lon"))
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -205,7 +205,7 @@ app.Macros().String.RegisterFunc("range", func(minLength, maxLength int) func(st
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Get("/limitchar/{name:string range(1,200)}", func(ctx iris.Context) {
|
app.Get("/limitchar/{name:string range(1,200) else 400}", func(ctx iris.Context) {
|
||||||
name := ctx.Params().Get("name")
|
name := ctx.Params().Get("name")
|
||||||
ctx.Writef(`Hello %s | the name should be between 1 and 200 characters length
|
ctx.Writef(`Hello %s | the name should be between 1 and 200 characters length
|
||||||
otherwise this handler will not be executed`, name)
|
otherwise this handler will not be executed`, name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user