I have a Laravel 5.3 application.
Inside my api.php file api.php is a route for posting the response as part of the survey.
Route::group(['middleware' => 'auth:api'], function () { Route::post('/poll/answer', 'API\ PollsController@createAnswer '); });
The route is part of a group limited to the auth:api middleware using the Laravel Passport engine.
When calling this route from Postman or any other tool for testing the API, I get 401, which is normal, because I am not attaching a token.
But when the module tests this call with PHPUnit, it returns 500. I have no idea why.
$this->postJson('api/poll/answer');
I probably have no setup or setup instructions.
Any ideas?
Felipe peña
source share