Fetch response of redirect in IntegrationTest

In HttpClient there is the option of following a redirect after eg. a GET-request.

Is there a similar feature in the IntegrationTest? As far as I got, there is only the possibility to get the redirected location.

The existing assert methods assertRedirectContains, assertRedirectEquals, assertRedirectNotEquals and so on all refer to the response header, would need the response body.

Thank you.

In the IntegrationTestTrait there are these choices that contain the sting response body. Can any of them work for you’re purpose?

What I usually do is after assertRedirect, do a simple

$this->get($this->_response->getHeaderLine('Location'));
1 Like

Thank you, @raul388 good solution, should be enough for my use cases. A redirect flag like HttpClient has would be nice though, I’ll suggest a new feature on github.

thank you, but all these methods only contain body data from the initial request (and not the redirect)