Skip to content

Commit 2fe2614

Browse files
committed
Fix CURL Json POST #3489
1 parent ca6ac76 commit 2fe2614

File tree

1 file changed

+3
-2
lines changed
  • lib/internal/Magento/Framework/HTTP/Client

1 file changed

+3
-2
lines changed

lib/internal/Magento/Framework/HTTP/Client/Curl.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,17 +338,18 @@ public function getStatus()
338338
* @param string $method
339339
* @param string $uri
340340
* @param array $params
341+
* @param bool $json
341342
* @return void
342343
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
343344
* @SuppressWarnings(PHPMD.NPathComplexity)
344345
*/
345-
protected function makeRequest($method, $uri, $params = [])
346+
protected function makeRequest($method, $uri, $params = [], $json = false)
346347
{
347348
$this->_ch = curl_init();
348349
$this->curlOption(CURLOPT_URL, $uri);
349350
if ($method == 'POST') {
350351
$this->curlOption(CURLOPT_POST, 1);
351-
$this->curlOption(CURLOPT_POSTFIELDS, http_build_query($params));
352+
$this->curlOption(CURLOPT_POSTFIELDS, $json ? json_encode($params) : http_build_query($params));
352353
} elseif ($method == "GET") {
353354
$this->curlOption(CURLOPT_HTTPGET, 1);
354355
} else {

0 commit comments

Comments
 (0)