I am using Axios in a Laravel app for a GET request, however for some reason the request is returning the exception: UnexpectedValueException with the message:
"The Response content must be a string or object implementing __toString(), "boolean" given."
The request is returning this exception, regardless of what I include in the response.
Switching out the Axios request for a jQuery request works just fine, so I am assuming it is an issue with the Axios library.
This request returns the exception:
axios.get(`/prospect/fetch`);
However this jQuery request works just fine:
$.get('/prospect/fetch');
Laravel fetch function:
public function fetch() {
return response()->json([
'collection' => Prospect::all()
]);
}
Route for url:
Route::get('/prospect/fetch', 'ProspectController@fetch')->name('admin.dashboard.prospect.fetch');
What is wrong with the Axios request?