From 1f07860dd957ae7513d61d106625b0316f3713d0 Mon Sep 17 00:00:00 2001 From: Trevor Hartman Date: Tue, 21 Apr 2020 07:47:30 -0700 Subject: [PATCH] [impr-#913] Mage_HTTP_Client_Curl::makeRequest() does not support json encoded strings --- lib/Mage/HTTP/Client/Curl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Mage/HTTP/Client/Curl.php b/lib/Mage/HTTP/Client/Curl.php index db1a3b5fdf4..b4d3520be47 100644 --- a/lib/Mage/HTTP/Client/Curl.php +++ b/lib/Mage/HTTP/Client/Curl.php @@ -345,7 +345,7 @@ public function getStatus() * Make request * @param string $method * @param string $uri - * @param array $params + * @param array|string $params pass an array to form post, pass a json encoded string to directly post json * @return null */ protected function makeRequest($method, $uri, $params = array()) @@ -354,7 +354,7 @@ protected function makeRequest($method, $uri, $params = array()) $this->curlOption(CURLOPT_URL, $uri); if($method == 'POST') { $this->curlOption(CURLOPT_POST, 1); - $this->curlOption(CURLOPT_POSTFIELDS, http_build_query($params)); + $this->curlOption(CURLOPT_POSTFIELDS, is_array($params) ? http_build_query($params) : $params); } elseif($method == "GET") { $this->curlOption(CURLOPT_HTTPGET, 1); } else {