From 092e3558506c033ef8ad6fb9efb55c0f2c11e7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 17 Mar 2021 16:52:36 +0800 Subject: [PATCH] add clear --- wchat/common/HttpClient.php | 6 +++++- wchat/officialaccount/Authorization.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index b0448e3..6c1688d 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -666,7 +666,11 @@ class HttpClient } curl_setopt($ch, CURLOPT_HEADER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, $this->parseHeaderMat()); + + $headers = $this->parseHeaderMat(); + if (!empty($headers) && is_array($headers)) { + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + } curl_setopt($ch, CURLOPT_USERAGENT, $this->agent); if (file_exists($cert = $this->getSslCertFile())) { diff --git a/wchat/officialaccount/Authorization.php b/wchat/officialaccount/Authorization.php index 2fb4675..90899df 100644 --- a/wchat/officialaccount/Authorization.php +++ b/wchat/officialaccount/Authorization.php @@ -42,6 +42,7 @@ class Authorization extends AfficialAccount $requestParam['lang'] = 'zh_CN'; $client = HttpClient::NewRequest(); + $client->setUseSwoole($this->getConfig()->isUsrSwoole()); $result = $client->get($this->snsUserInfo, $requestParam); if ($result->isResultsOK()) { return $result; @@ -65,6 +66,7 @@ class Authorization extends AfficialAccount $requestParam['grant_type'] = 'authorization_code'; $client = HttpClient::NewRequest(); + $client->setUseSwoole($this->getConfig()->isUsrSwoole()); return $client->get($this->oauth2, $requestParam); }