Skip to content

Commit

Permalink
CurlService should set its headers first so user's extraOptions can o…
Browse files Browse the repository at this point in the history
…verride
  • Loading branch information
robocoder committed Dec 8, 2023
1 parent 82b1947 commit 55ac666
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/WebDriver/Service/CurlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions

case 'POST':
case 'PUT':
$parameters = ! $parameters || ! is_array($parameters)
? '{}'
$parameters = ! $parameters || ! is_array($parameters)
? '{}' // instead of json_encode(new \stdclass))
: json_encode($parameters);

curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
Expand All @@ -71,12 +71,12 @@ public function execute($requestMethod, $url, $parameters = null, $extraOptions
break;
}

curl_setopt($curl, CURLOPT_HTTPHEADER, $customHeaders);

foreach ($extraOptions as $option => $value) {
curl_setopt($curl, $option, $value);
}

curl_setopt($curl, CURLOPT_HTTPHEADER, $customHeaders);

$rawResult = trim(curl_exec($curl));

$info = curl_getinfo($curl);
Expand Down

0 comments on commit 55ac666

Please sign in to comment.