In Laravel's unit test, I can test a JSON API like that:
$this->post('/user', ['name' => 'Sally'])
->seeJson([
'created' => true,
]);
But what if I want to use the response. How can I get the JSON response (as an array) using $this->post()
?
Proper way to get the content is:
$content = $this->get('/v1/users/1')->decodeResponseJson();