From f174d9450ef94e810a5b64602c0ba5b7be40e5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 25 Nov 2020 16:26:42 +0800 Subject: [PATCH] add clear --- wchat/common/HttpClient.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index fa456b8..af01af6 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -623,7 +623,7 @@ class HttpClient private function curl($url, $data = []) { try { - $output = $this->curlParse($url, $this->mergeParams($data)); + $output = $this->curlParse($url, $data); if ($output === FALSE) { return new Result(['code' => 500, 'message' => $output]); } @@ -680,9 +680,10 @@ class HttpClient if ($this->method == self::POST) { curl_setopt($ch, CURLOPT_POST, 1); } - - if ($this->method != self::GET) { + if ($this->method == self::GET || !empty($this->_data)) { curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data)); } curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));