$response = Http::withHeaders([
'Accept' => 'application/json'
])->post('https://example.com', [
'body' => [
'test' => 1
]
]);
May 5, 2020
6
Level 16
Http client post raw content
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?
Please or to participate in this conversation.