| 8 | ) |
| 9 | |
| 10 | func TestSessionsEncodeDecode(t *testing.T) { |
| 11 | app := newApp() |
| 12 | e := httptest.New(t, app, httptest.URL("http://example.com")) |
| 13 | |
| 14 | es := e.GET("/set").Expect() |
| 15 | es.Status(iris.StatusOK) |
| 16 | es.Cookies().NotEmpty() |
| 17 | es.Body().IsEqual("All ok session set to: iris [isNew=true]") |
| 18 | |
| 19 | e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: iris") |
| 20 | // delete and re-get |
| 21 | e.GET("/delete").Expect().Status(iris.StatusOK) |
| 22 | e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ") |
| 23 | // set, clear and re-get |
| 24 | e.GET("/set").Expect().Body().IsEqual("All ok session set to: iris [isNew=false]") |
| 25 | e.GET("/clear").Expect().Status(iris.StatusOK) |
| 26 | e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ") |
| 27 | } |