This is how i get response in test Case
$response = $this->call('POST','/api/auth/login',['username'=>'xx','password'=>'xxx'], [/* cookies */], [/* files */], ['HTTP_ClientSecret' => 'xxxx']);
Then we can get response content by like this
$response->getContents()
i want to know how to get response header data ?
Do something like:
$response->headers->get('content-type');
or whatever you need. Also dd($response->headers);
might be useful to you if you want to see what is in your response headers.
$this->call()
returns Response which is extending Symfony's Response and headers
is an object ResponseHeaderBag
which has the following methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With