add clear
This commit is contained in:
+10
-7
@@ -428,15 +428,18 @@ class HttpClient
|
|||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
if ($output === FALSE) {
|
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) {
|
||||||
|
$data = new Result(['code' => 500, 'message' => $body, 'header' => $header]);
|
||||||
if ($status != 200) {
|
} else {
|
||||||
return new Result(['code' => 500, 'message' => $body, 'header' => $header]);
|
$data = $this->structure($body, $data, $header);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->structure($body, $data, $header);
|
unset($ch);
|
||||||
|
return $data;
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
return new Result(['code' => 500, 'message' => $exception->getMessage(), 'header' => []]);
|
return new Result(['code' => 500, 'message' => $exception->getMessage(), 'header' => []]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user