Skip to content

Commit

Permalink
Driver: Append headers instead of overwriting them
Browse files Browse the repository at this point in the history
  • Loading branch information
chibimagic committed Mar 26, 2015
1 parent 6f44ac6 commit f72ff16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ public static function Curl($http_type, $full_url, $payload = null, $escape_payl
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $http_type);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, WebDriver::$CurlConnectTimeoutSec);
curl_setopt($curl, CURLOPT_TIMEOUT, WebDriver::$CurlTimeoutSec);
$headers = array('Expect:');
if ($payload !== null && is_string($payload) && json_decode($payload) !== null) {
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$headers[] = 'Content-Type: application/json';
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
if (($http_type === "POST" || $http_type === "PUT") && $payload !== null) {
if ($escape_payload && (is_array($payload) || is_object($payload))) {
$payload = http_build_query($payload);
Expand Down

0 comments on commit f72ff16

Please sign in to comment.