Skip to content

Commit

Permalink
Merge pull request #22 from jakubboucek/fix-json-req
Browse files Browse the repository at this point in the history
Fix invalid request format - present Json, but really send mutipart form
  • Loading branch information
Tlapi authored Feb 25, 2020
2 parents eea4c56 + d185333 commit 57ebeab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Ecomail.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ private function send($request, $data = NULL, $method = NULL)
}

if (is_array($data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$options = 0 | (PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, $options));
}

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
Expand Down

0 comments on commit 57ebeab

Please sign in to comment.