vendredi 1 mai 2020

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire