Laravel 7 HTTP Client - Unable to send POST request with `body`

Using Laravel 7.6 and it's built-in HTTP Client.

I'm trying to send a simple POST request with body in Raw JSON format to my other domain but no luck:

$response = Http::post('https://example.com', [
'body' => '{ test: 1 }'
]);

I get 400 Bad Request - Client error - because my server expects body as a mandatory.

What am I missing here?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3d3KBbZ
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time