What do you get if you dd before sending
$response = Http::dd()->withOptions(['verify' => false])
->withBasicAuth($this->user, $this->pass)
->post($this->apiUrl . '/orders/create', $payload);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
The issue arose when I was not getting a proper response from a post request to an external api. The response the external api endpoint was returning was that of a GET request, not POST. So it appears that the HTTP facade sends get request instead of post.
$response = Http::withOptions(['verify' => false])
->withBasicAuth($this->user, $this->pass)
->post($this->apiUrl . '/orders/create', $payload);
dd($response);
/*
Illuminate\Http\Client\Response^ {#7743
#response: GuzzleHttp\Psr7\Response^ {#7810
-reasonPhrase: "OK"
-statusCode: 200
-headers: array:9 [...]
-headerNames: array:9 [...]
-protocol: "1.1"
-stream: GuzzleHttp\Psr7\Stream^ {#7811 ...}
}
+"transferStats": GuzzleHttp\TransferStats^ {#7795
-request: GuzzleHttp\Psr7\Request^ {#7794
-method: "GET"
-requestTarget: null
-uri: GuzzleHttp\Psr7\Uri^ {#7782
-scheme: "http"
-userInfo: ""
-host: "example.api.com"
-port: null
-path: "/orders/create/"
-query: ""
-fragment: ""
-composedComponents: "http://example.api.com/orders/create/"
}
}
}
}
*/
The issue resolved when I added a trailing slash to the url /orders/create/. Apparently, the POST method in this case somehow was being converted to GET because of the absence of that trailing slash.
Please or to participate in this conversation.