改名
This commit is contained in:
@@ -48,10 +48,10 @@ class Client extends ClientAbstracts
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$client = $this->generate_client($data, ...$url);
|
$client = $this->generate_client($data, ...$url);
|
||||||
|
$this->setData('');
|
||||||
if ($client->statusCode < 0) {
|
if ($client->statusCode < 0) {
|
||||||
throw new Exception($client->errMsg);
|
throw new Exception($client->errMsg);
|
||||||
}
|
}
|
||||||
$this->setData('');
|
|
||||||
$body = $this->resolve($client->getHeaders(), $client->body);
|
$body = $this->resolve($client->getHeaders(), $client->body);
|
||||||
if (in_array($client->getStatusCode(), [200, 201])) {
|
if (in_array($client->getStatusCode(), [200, 201])) {
|
||||||
return $this->structure($body, $data, $client->getHeaders());
|
return $this->structure($body, $data, $client->getHeaders());
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ abstract class ClientAbstracts extends Component implements IClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function cleanData(): void
|
||||||
|
{
|
||||||
|
$this->_data = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ class Curl extends ClientAbstracts
|
|||||||
*/
|
*/
|
||||||
private function execute($curl): Result|bool|array|string
|
private function execute($curl): Result|bool|array|string
|
||||||
{
|
{
|
||||||
|
defer(function () {
|
||||||
|
$this->cleanData();
|
||||||
|
});
|
||||||
$output = curl_exec($curl);
|
$output = curl_exec($curl);
|
||||||
if ($output === false) {
|
if ($output === false) {
|
||||||
return $this->fail(400, curl_error($curl));
|
return $this->fail(400, curl_error($curl));
|
||||||
|
|||||||
Reference in New Issue
Block a user