mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
fix ZMRequest array data convert
This commit is contained in:
@@ -57,6 +57,10 @@ class ZMRequest
|
||||
'url' => ($url instanceof UriInterface ? $url->__toString() : $url),
|
||||
], $config));
|
||||
$socket->withoutAsync();
|
||||
if (is_array($data)) {
|
||||
$data = http_build_query($data);
|
||||
$header['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
$obj = $socket->post($data, $header, fn (ResponseInterface $response) => $response, fn () => false);
|
||||
if ($obj instanceof ResponseInterface) {
|
||||
if ($obj->getStatusCode() !== 200 && $only_body) {
|
||||
|
||||
Reference in New Issue
Block a user