mirror of
https://github.com/kataras/iris.git
synced 2026-01-24 04:15:56 +00:00
add uint8 parameter type, and mvc and hero - this commit may be a point of tutorial on how to add a completely new type from scratch to the hero for future contributors
Former-commit-id: dc7a7e6c97ef0c644a22e92072e4bdb98ae10582
This commit is contained in:
@@ -366,7 +366,8 @@ func (c *testControllerRelPathFromFunc) EndRequest(ctx context.Context) {
|
||||
|
||||
func (c *testControllerRelPathFromFunc) Get() {}
|
||||
func (c *testControllerRelPathFromFunc) GetBy(uint64) {}
|
||||
func (c *testControllerRelPathFromFunc) GetRatioBy(int64) {}
|
||||
func (c *testControllerRelPathFromFunc) GetUint8RatioBy(uint8) {}
|
||||
func (c *testControllerRelPathFromFunc) GetUint64RatioBy(int64) {}
|
||||
func (c *testControllerRelPathFromFunc) GetAnythingByWildcard(string) {}
|
||||
|
||||
func (c *testControllerRelPathFromFunc) GetLogin() {}
|
||||
@@ -391,8 +392,11 @@ func TestControllerRelPathFromFunc(t *testing.T) {
|
||||
|
||||
e.GET("/18446744073709551615").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/18446744073709551615")
|
||||
e.GET("/ratio/-42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/ratio/-42")
|
||||
e.GET("/uint8/ratio/255").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/uint8/ratio/255")
|
||||
e.GET("/uint8/ratio/256").Expect().Status(iris.StatusNotFound)
|
||||
e.GET("/uint64/ratio/-42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/uint64/ratio/-42")
|
||||
e.GET("/something/true").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/true")
|
||||
e.GET("/something/false").Expect().Status(iris.StatusOK).
|
||||
|
||||
@@ -47,6 +47,11 @@ func makeFuncParamGetter(paramType ast.ParamType, paramName string) reflect.Valu
|
||||
v, _ := ctx.Params().GetInt64(paramName)
|
||||
return v
|
||||
}
|
||||
case ast.ParamTypeUint8:
|
||||
fn = func(ctx context.Context) uint8 {
|
||||
v, _ := ctx.Params().GetUint8(paramName)
|
||||
return v
|
||||
}
|
||||
case ast.ParamTypeUint64:
|
||||
fn = func(ctx context.Context) uint64 {
|
||||
v, _ := ctx.Params().GetUint64(paramName)
|
||||
|
||||
Reference in New Issue
Block a user