Laravel - HTTP Tests - Customizing Request Headers

You may use the withHeaders method to customize the request's headers before it is sent to the application. This method allows you to add any custom headers you would like to the request:

    
    withHeaders([
                'X-Header' => 'Value',
            ])->post('/user', ['name' => 'Sally']);
    
            $response->assertStatus(201);
        }
    }