Skip to content

Commit

Permalink
Driver: Explicitly specify content length on POST/PUT requests
Browse files Browse the repository at this point in the history
  • Loading branch information
chibimagic committed Mar 26, 2015
1 parent 93d160e commit 35abc0b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public static function Curl($http_type, $full_url, $payload = null, $escape_payl
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, WebDriver::$CurlConnectTimeoutSec);
curl_setopt($curl, CURLOPT_TIMEOUT, WebDriver::$CurlTimeoutSec);
$headers = array('Expect:');
if ($http_type === "POST" || $http_type === "PUT") {
$headers[] = 'Content-Length: ' . strlen($payload);
}
if ($payload !== null && is_string($payload) && json_decode($payload) !== null) {
$headers[] = 'Content-Type: application/json; charset=utf-8';
}
Expand Down

0 comments on commit 35abc0b

Please sign in to comment.