| 120 | } |
| 121 | |
| 122 | func TestControllerBeginAndEndRequestFunc(t *testing.T) { |
| 123 | app := iris.New() |
| 124 | New(app.Party("/profile/{username}")). |
| 125 | Handle(new(testControllerBeginAndEndRequestFunc)) |
| 126 | |
| 127 | e := httptest.New(t, app) |
| 128 | usernames := []string{ |
| 129 | "kataras", |
| 130 | "makis", |
| 131 | "efi", |
| 132 | "rg", |
| 133 | "bill", |
| 134 | "whoisyourdaddy", |
| 135 | } |
| 136 | doneResponse := "done" |
| 137 | |
| 138 | for _, username := range usernames { |
| 139 | e.GET("/profile/" + username).Expect().Status(iris.StatusOK). |
| 140 | Body().IsEqual(username + doneResponse) |
| 141 | e.POST("/profile/" + username).Expect().Status(iris.StatusOK). |
| 142 | Body().IsEqual(username + doneResponse) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func TestControllerBeginAndEndRequestFuncBindMiddleware(t *testing.T) { |
| 147 | app := iris.New() |