mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 16:45:35 +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),
|
'url' => ($url instanceof UriInterface ? $url->__toString() : $url),
|
||||||
], $config));
|
], $config));
|
||||||
$socket->withoutAsync();
|
$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);
|
$obj = $socket->post($data, $header, fn (ResponseInterface $response) => $response, fn () => false);
|
||||||
if ($obj instanceof ResponseInterface) {
|
if ($obj instanceof ResponseInterface) {
|
||||||
if ($obj->getStatusCode() !== 200 && $only_body) {
|
if ($obj->getStatusCode() !== 200 && $only_body) {
|
||||||
|
|||||||
Reference in New Issue
Block a user