Question : test post request laravel
Answered by : kevin-fritsch
<?php
namespace Tests\Feature;
use Tests\TestCase;
class ExampleTest extends TestCase
{ /** * A basic functional test example. * * @return void */ public function test_interacting_with_headers() { $response = $this->withHeaders([ 'X-Header' => 'Value', ])->post('/user', ['name' => 'Sally']);
$response->assertStatus(201); }
}
Source : https://laravel.com/docs/9.x/http-tests | Last Update : Sat, 09 Jul 22