Can anyone explain why the status code of the response generated by Laravel would be 201 instead of 200?
<?php
namespace App\Http\Actions\User;
use App\Http\Resources\UserResource;
use Illuminate\Support\Facades\Auth;
class ShowMeAction
{
public function __invoke()
{
return new UserResource(Auth::user());
}
}
Middleware for this action is the default "api" middleware stack coming with Laravel 5.7 + spatie/cors + auth:api.
Other actions correctly return a 200 status code without me specifying anything…
Here's the failing test:
$response = $this->actingAs($user, 'api')->get('/api/v1/users/me');
$response->assertOk();
1) Tests\Feature\User\ShowMeTest::test_it_shows_the_authenticated_users_resource
Response status code [201] does not match expected 200 status code.
Failed asserting that false is true.