I have seen many examples of how to set headers for a response, but I cannot find a way to check the headers of a response.
For example, in a test case, I:
public function testGetJson() { $response = $this->action('GET', ' LocationTypeController@index ', null, array('Accept' => 'application/json')); $this->assertResponseStatus(200); //some code here to test that the response content-type is 'application/json' } public function testGetXml() { $response = $this->action('GET', ' LocationTypeController@index ', null, array('Accept' => 'text/xml')); $this->assertResponseStatus(200); //some code here to test that the response content-type is 'text/xml' }
How can I verify that the content type header is "application / json" or any other content type? Maybe I donโt understand something?
The controllers that I have can do the negation of the content with an Accept header, and I want to make sure the content type in the response is correct.
Thanks!
source share