From f3af9e81967489a8256829906ce4524d41cbf250 Mon Sep 17 00:00:00 2001 From: thefosk Date: Tue, 14 Jan 2014 10:34:19 -0800 Subject: [PATCH] fix --- lib/Unirest/Unirest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 .= "&";