Search code examples
http-redirectplayframeworkfunctional-testing

How to check where it page is going to redirect to


Play framework functional test

    public class MyFunctionalTest extends FunctionalTest {

        Http.Response response = GET( "/page1");

        assertStatus(302/*REDIRECT*/, response);

        ///TODO: check where it redirects to
...

How to check where it will redirect to? which url?


Solution

  • You can check for the location-header:

    assertEquals("/yourExpectedTarget", response.getHeader("Location"));