mirror of
https://github.com/kataras/iris.git
synced 2025-12-24 05:17:03 +00:00
Version 11 released. Read https://github.com/kataras/iris/blob/master/HISTORY.md#su-21-october-2018--v1100
Former-commit-id: fe6305deed00e170bf4d39a12c0644fe686e0a24
This commit is contained in:
@@ -29,12 +29,12 @@ func main() {
|
||||
app.Get("/donate", donateHandler, donateFinishHandler)
|
||||
|
||||
// Pssst, don't forget dynamic-path example for more "magic"!
|
||||
app.Get("/api/users/{userid:int min(1)}", func(ctx iris.Context) {
|
||||
userID, err := ctx.Params().GetInt("userid")
|
||||
app.Get("/api/users/{userid:uint64 min(1)}", func(ctx iris.Context) {
|
||||
userID, err := ctx.Params().GetUint64("userid")
|
||||
|
||||
if err != nil {
|
||||
ctx.Writef("error while trying to parse userid parameter," +
|
||||
"this will never happen if :int is being used because if it's not integer it will fire Not Found automatically.")
|
||||
"this will never happen if :uint64 is being used because if it's not a valid uint64 it will fire Not Found automatically.")
|
||||
ctx.StatusCode(iris.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user