From 3d16592366a9e0d84b4403155d5634e7be978710 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 19 Dec 2019 12:17:56 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index d5e2e74..530e968 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -356,9 +356,13 @@ class HttpClient $client->get($url . '?' . $data); } else if (strtolower($this->method) == self::PUT) { $client->setMethod('PUT'); - $client->setHeaders([ - 'Content-Type' => 'application/json' - ]); + if (!is_string($data)) { + $data = json_encode($data, JSON_UNESCAPED_UNICODE); + } + $client->setData($data); + $client->execute($url); + } else if (strtolower($this->method) == self::DELETE) { + $client->setMethod('DELETE'); if (!is_string($data)) { $data = json_encode($data, JSON_UNESCAPED_UNICODE); }