mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
new feature: versioned controllers
Former-commit-id: c797e23c78b1e74bbe9ba56673f3a98f17f5e2f7
This commit is contained in:
@@ -703,6 +703,31 @@ func TestControllerOverlapping(t *testing.T) {
|
||||
m.Handle(new(publicController))
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").WithQuery("name", "kataras").Expect().Status(httptest.StatusOK).JSON().Equal(iris.Map{"id": 1})
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).JSON().Equal(iris.Map{"data": "things"})
|
||||
e.GET("/").WithQuery("name", "kataras").Expect().Status(httptest.StatusOK).
|
||||
JSON().Equal(iris.Map{"id": 1})
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).
|
||||
JSON().Equal(iris.Map{"data": "things"})
|
||||
}
|
||||
|
||||
type testControllerMethodHandlerBindStruct struct{}
|
||||
|
||||
type queryData struct {
|
||||
Name string `json:"name" url:"name"`
|
||||
}
|
||||
|
||||
func (*testControllerMethodHandlerBindStruct) Any(data queryData) queryData {
|
||||
return data
|
||||
}
|
||||
|
||||
func TestControllerMethodHandlerBindStruct(t *testing.T) {
|
||||
app := iris.New()
|
||||
|
||||
New(app).Handle(new(testControllerMethodHandlerBindStruct))
|
||||
|
||||
data := iris.Map{"name": "kataras"}
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
|
||||
e.PATCH("/").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
|
||||
// more tests inside the hero package itself.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user