Skip to content

Commit

Permalink
Merge pull request #105 from voodoodrul/patch-2
Browse files Browse the repository at this point in the history
Don't use CURLOPT_CUSTOMREQUEST for POSTs
  • Loading branch information
Ahmad Nassri committed Apr 29, 2016
2 parents 889ca14 + a3446f6 commit 53656bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Unirest/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ public static function send($method, $url, $body = null, $headers = array(), $us
self::$handle = curl_init();

if ($method !== Method::GET) {
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
if ($method === Method::POST) {
curl_setopt(self::$handle, CURLOPT_POST, true);
} else {
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
}

curl_setopt(self::$handle, CURLOPT_POSTFIELDS, $body);
} elseif (is_array($body)) {
Expand Down

0 comments on commit 53656bf

Please sign in to comment.