1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

start of the vue + mvc example and a simple session binding

Former-commit-id: 994f00952352c93d270ad197cb843f3222fb37c0
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-12-14 05:56:23 +02:00
parent d72c649441
commit 0b2dcc76f5
12 changed files with 438 additions and 3 deletions

View File

@@ -260,6 +260,12 @@ func (t *testControllerBindStruct) Get() {
t.Ctx.Writef(t.TitlePointer.title + t.TitleValue.title + t.Other)
}
// test if context can be binded to the controller's function
// without need to declare it to a struct if not needed.
func (t *testControllerBindStruct) GetCtx(ctx iris.Context) {
ctx.StatusCode(iris.StatusContinue)
}
type testControllerBindDeep struct {
testControllerBindStruct
}
@@ -268,6 +274,7 @@ func (t *testControllerBindDeep) Get() {
// t.testControllerBindStruct.Get()
t.Ctx.Writef(t.TitlePointer.title + t.TitleValue.title + t.Other)
}
func TestControllerBind(t *testing.T) {
app := iris.New()
// app.Logger().SetLevel("debug")
@@ -287,6 +294,8 @@ func TestControllerBind(t *testing.T) {
expected := t1 + t2
e.GET("/").Expect().Status(iris.StatusOK).
Body().Equal(expected)
e.GET("/ctx").Expect().Status(iris.StatusContinue)
e.GET("/deep").Expect().Status(iris.StatusOK).
Body().Equal(expected)
}