From 954cf6999cfae958acaef66d9fff86964cf51280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 27 May 2020 16:19:04 +0800 Subject: [PATCH] add clear --- wchat/common/HttpClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index eee966d..9175a89 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -557,8 +557,10 @@ class HttpClient } $contentType = 'application/x-www-form-urlencoded'; - if (isset($this->header['CONTENT-TYPE'])) { - $contentType = $this->header['CONTENT-TYPE']; + if (isset($this->header['Content-Type'])) { + $contentType = $this->header['Content-Type']; + } else if (isset($this->header['content-type'])) { + $contentType = $this->header['content-type']; } if (strpos($contentType, 'json') !== false) { @@ -712,7 +714,7 @@ class HttpClient if (is_array($body)) { return $body; } - $type = $data['content-type'] ?? 'text/html'; + $type = $data['content-type'] ?? $data['Content-Type'] ?? 'text/html'; if (strpos($type, 'text/html') !== false) { return $body; } else if (strpos($type, 'json') !== false) {