How to reproduce the problem on Laravel 9.52:

$client = Illuminate\Support\Facades\Http::buildClient();
$response = $client->get('https://google.com');

You can easily check this in tinker. It happens to return an instance of GuzzleHttp\Client but I only care for PSR-7 compatibility, since I want to pass the client to a library that expects a PSR-7 compatible client.

But the client is actually not usable and the second line throws the exception that the array key "laravel_data" is not set.

It happens in line 1200 of Illuminate/Http/Client/PendingRequest.php: https://github.com/laravel/framework/blob/082345d76fc6a55b649572efe10b11b03e279d24/src/Illuminate/Http/Client/PendingRequest.php#L1200

My approach seems obvious and I did search a lot for alternatives, but to no avail. How do you do it?

0

There are 0 answers