diff --git a/lib/WebDriver/Service/CurlService.php b/lib/WebDriver/Service/CurlService.php index 76a3d6e..b7d13e8 100755 --- a/lib/WebDriver/Service/CurlService.php +++ b/lib/WebDriver/Service/CurlService.php @@ -53,16 +53,12 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions break; case 'POST': - if ($parameters && is_array($parameters)) { - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters)); - } else { - $customHeaders[] = 'Content-Length: 0'; - - // Suppress "Transfer-Encoding: chunked" header automatically added by cURL that - // causes a 400 bad request (bad content-length). - $customHeaders[] = 'Transfer-Encoding:'; + if ( ! $parameters || ! is_array($parameters)) { + $parameters = array(); } + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters)); + // Suppress "Expect: 100-continue" header automatically added by cURL that // causes a 1 second delay if the remote server does not support Expect. $customHeaders[] = 'Expect:'; @@ -75,16 +71,12 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions break; case 'PUT': - if ($parameters && is_array($parameters)) { - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters)); - } else { - $customHeaders[] = 'Content-Length: 0'; - - // Suppress "Transfer-Encoding: chunked" header automatically added by cURL that - // causes a 400 bad request (bad content-length). - $customHeaders[] = 'Transfer-Encoding:'; + if ( ! $parameters || ! is_array($parameters)) { + $parameters = array(); } + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($parameters)); + // Suppress "Expect: 100-continue" header automatically added by cURL that // causes a 1 second delay if the remote server does not support Expect. $customHeaders[] = 'Expect:';