diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php index 440f9ae..c973bd6 100644 --- a/lib/Unirest/Unirest.php +++ b/lib/Unirest/Unirest.php @@ -171,13 +171,13 @@ private static function request($httpMethod, $url, $body = NULL, $headers = arra $ch = curl_init(); if ($httpMethod != HttpMethod::GET) { - curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod); - if( is_array($body) || $body instanceof Traversable ) { - Unirest::http_build_query_for_curl($body, $postBody); - curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody); - } else { - curl_setopt ($ch, CURLOPT_POSTFIELDS, $body); - } + curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $httpMethod); + if( is_array($body) || $body instanceof Traversable ) { + Unirest::http_build_query_for_curl($body, $postBody); + curl_setopt ($ch, CURLOPT_POSTFIELDS, $postBody); + } else { + curl_setopt ($ch, CURLOPT_POSTFIELDS, $body); + } } else if (is_array($body)) { if (strpos($url,'?') !== false) { $url .= "&";