From 9c415292a4de26089117eeb222dfbac7306dec32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 22 May 2020 15:17:24 +0800 Subject: [PATCH] add clear --- wchat/base/Subject.php | 2 +- wchat/base/Template.php | 2 +- wchat/common/HttpClient.php | 2 +- wchat/officialaccount/SourceMaterial.php | 2 +- wchat/wx/Message.php | 2 +- wchat/wx/PublicTemplate.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wchat/base/Subject.php b/wchat/base/Subject.php index b04d848..2ebfb21 100644 --- a/wchat/base/Subject.php +++ b/wchat/base/Subject.php @@ -116,7 +116,7 @@ abstract class Subject extends Miniprogarampage $params = json_encode($params, JSON_UNESCAPED_UNICODE); $this->request->setIsSSL(true); - $this->request->addHeader('content-type', 'application/json'); + $this->request->addHeader('Content-Type', 'application/json'); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); diff --git a/wchat/base/Template.php b/wchat/base/Template.php index 95e29fc..edead70 100644 --- a/wchat/base/Template.php +++ b/wchat/base/Template.php @@ -128,7 +128,7 @@ abstract class Template extends Miniprogarampage } $params = json_encode($params, JSON_UNESCAPED_UNICODE); $this->request->setIsSSL(true); - $this->request->addHeader('content-type', 'application/json'); + $this->request->addHeader('Content-Type', 'application/json'); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); $result = $this->request->post($url, $params); diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index 720bec6..891255b 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -706,7 +706,7 @@ class HttpClient if (is_array($body)) { return $body; } - $type = $data['content-type'] ?? 'text/html'; + $type = $data['Content-Type'] ?? 'text/html'; if (strpos($type, 'text/html') !== false) { return $body; } else if (strpos($type, 'json') !== false) { diff --git a/wchat/officialaccount/SourceMaterial.php b/wchat/officialaccount/SourceMaterial.php index 20b5eca..d82b882 100644 --- a/wchat/officialaccount/SourceMaterial.php +++ b/wchat/officialaccount/SourceMaterial.php @@ -85,7 +85,7 @@ class SourceMaterial extends AfficialAccount { $uploadInfo['media'] = new \CURLFile($file); $uploadInfo['form-data[filename]'] = $uploadInfo['media']->getFilename(); - $uploadInfo['form-data[content-type]'] = $uploadInfo['media']->getMimeType(); + $uploadInfo['form-data[Content-Type]'] = $uploadInfo['media']->getMimeType(); $accessToken = $this->config->getAccessToken(); diff --git a/wchat/wx/Message.php b/wchat/wx/Message.php index d87a0f9..88716ad 100644 --- a/wchat/wx/Message.php +++ b/wchat/wx/Message.php @@ -249,7 +249,7 @@ class Message extends SmallProgram $real_path = new \CURLFile(realpath($filePath)); - $data = array("media" => $real_path, 'form-data[filename]' => $filePath, 'form-data[content-type]' => $mime); + $data = array("media" => $real_path, 'form-data[filename]' => $filePath, 'form-data[Content-Type]' => $mime); if ($isPermanent && $mime == 'video/mp3') { $data = ['media' => $real_path, 'description[title]' => $title, 'description[introduction]' => $introduction]; } diff --git a/wchat/wx/PublicTemplate.php b/wchat/wx/PublicTemplate.php index 818a626..1547f2c 100644 --- a/wchat/wx/PublicTemplate.php +++ b/wchat/wx/PublicTemplate.php @@ -146,7 +146,7 @@ class PublicTemplate extends SmallProgram $params = json_encode($default, JSON_UNESCAPED_UNICODE); $this->request->setIsSSL(true); - $this->request->addHeader('content-type', 'application/json'); + $this->request->addHeader('Content-Type', 'application/json'); $this->request->setErrorField('errcode'); $this->request->setErrorMsgField('errmsg'); $result = $this->request->post($url, $default);