From 56cc706c6728e87447874c011a6a5d297b4895ea Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 13 Jan 2020 17:32:04 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index a252c37..474152d 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -399,28 +399,31 @@ class HttpClient if (!empty($this->header)) { $client->setHeaders($this->parseHeaderMat()); } + if (!empty($this->_data)) { + $client->setData($this->_data); + } if (strtolower($this->method) == self::GET) { - if (!empty($this->_data)) { - $client->setData($this->_data); - } if (!empty($data)) { $url .= '?' . $data; } $client->get($url); } else if (strtolower($this->method) == self::PUT) { $client->setMethod('PUT'); - var_dump($data); if (!is_string($data)) { $data = json_encode($data); } - $client->setData($data); + if (!empty($data)) { + $client->setData($data); + } $client->execute($url); } else if (strtolower($this->method) == self::DELETE) { $client->setMethod('DELETE'); if (!is_string($data)) { $data = json_encode($data); } - $client->setData($data); + if (!empty($data)) { + $client->setData($data); + } $client->execute($url); } else { $client->post($url, $data);