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();
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