diff --git a/common/HttpClient.php b/common/HttpClient.php index 39d28f5..0411b4c 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -428,15 +428,18 @@ class HttpClient curl_close($ch); if ($output === FALSE) { - return new Result(['code' => 500, 'message' => curl_error($ch)]); - } + $data = new Result(['code' => 500, 'message' => curl_error($ch)]); + } else { + [$header, $body, $status] = $this->explode($output); - [$header, $body, $status] = $this->explode($output); - - if ($status != 200) { - return new Result(['code' => 500, 'message' => $body, 'header' => $header]); + if ($status != 200) { + $data = new Result(['code' => 500, 'message' => $body, 'header' => $header]); + } else { + $data = $this->structure($body, $data, $header); + } } - return $this->structure($body, $data, $header); + unset($ch); + return $data; } catch (\Exception $exception) { return new Result(['code' => 500, 'message' => $exception->getMessage(), 'header' => []]); }