mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
Update to 8.4.0 | New macro type, new high-optimized MVC features. Read HISTORY.md
Former-commit-id: b72a23ba063be60a9750c8b1b0df024b0c8ed549
This commit is contained in:
@@ -436,3 +436,41 @@ func TestControllerInsideControllerRecursively(t *testing.T) {
|
||||
e.GET("/user/" + username).Expect().
|
||||
Status(httptest.StatusOK).Body().Equal(expected)
|
||||
}
|
||||
|
||||
type testControllerRelPathFromFunc struct{ mvc.Controller }
|
||||
|
||||
func (c *testControllerRelPathFromFunc) EndRequest(ctx context.Context) {
|
||||
ctx.Writef("%s:%s", ctx.Method(), ctx.Path())
|
||||
c.Controller.EndRequest(ctx)
|
||||
}
|
||||
|
||||
func (c *testControllerRelPathFromFunc) Get() {}
|
||||
func (c *testControllerRelPathFromFunc) GetLogin() {}
|
||||
func (c *testControllerRelPathFromFunc) PostLogin() {}
|
||||
|
||||
func (c *testControllerRelPathFromFunc) GetAdminLogin() {}
|
||||
func (c *testControllerRelPathFromFunc) PutSomethingIntoThis() {}
|
||||
func (c *testControllerRelPathFromFunc) GetBy(int64) {}
|
||||
|
||||
func (c *testControllerRelPathFromFunc) GetByWildcard(string) {}
|
||||
|
||||
func TestControllerRelPathFromFunc(t *testing.T) {
|
||||
app := iris.New()
|
||||
app.Controller("/", new(testControllerRelPathFromFunc))
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("GET:/")
|
||||
e.GET("/login").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("GET:/login")
|
||||
e.POST("/login").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("POST:/login")
|
||||
e.GET("/admin/login").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("GET:/admin/login")
|
||||
e.PUT("/something/into/this").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("PUT:/something/into/this")
|
||||
e.GET("/42").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("GET:/42")
|
||||
e.GET("/anything/here").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("GET:/anything/here")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user