Testing scala Play (2.2.1) controllers with CSRF protection

前端 未结 6 991
清歌不尽
清歌不尽 2021-01-13 17:21

I\'ve been having some problems testing controllers that use Play\'s CSRF protection. To demonstrate this, I\'ve created a very simple Play application that minimally exhibi

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-13 17:35

    To those that are still interested: I managed to solve this problem globally by enabling CSRF protection in tests. The app will then create a token for every request that does not contain one. See my answer to this question

提交回复
热议问题