How to manipulate Session, Request and Response for test in play2.0

后端 未结 2 695
一个人的身影
一个人的身影 2020-12-16 04:51

Hi I had an authentication service which works on Request (some Header-Data and Cookie), Response (to set or delete a cookie) and session (Store userId and rememberMe-inform

2条回答
  •  孤城傲影
    2020-12-16 05:20

    It was not ready for Play 2.0, but in Play 2.1 (and in current master) you’ll be able to write:

    fakeRequest(GET, "/foo")
        .withSession("bar", "baz")
        .withCookies(cookie("bah", "toto"));
    

提交回复
热议问题