From 86b432961eee42db3d661f6d10088d50108d4416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 7 Sep 2021 14:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-helper/Client/Curl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/http-helper/Client/Curl.php b/http-helper/Client/Curl.php index 855040ed..e76e3452 100644 --- a/http-helper/Client/Curl.php +++ b/http-helper/Client/Curl.php @@ -136,12 +136,14 @@ class Curl extends ClientAbstracts */ private function execute($curl): Result|bool|array|string { - defer(fn() => $this->cleanData()); $output = curl_exec($curl); if ($output === false) { - return $this->fail(400, curl_error($curl)); + $response = $this->fail(400, curl_error($curl)); + } else { + $response = $this->parseResponse($curl, $output); } - return $this->parseResponse($curl, $output); + $this->cleanData(); + return $response; }