Skip to content

Commit

Permalink
Merge pull request #18 from ldelcroix/master
Browse files Browse the repository at this point in the history
Fixes to autoloading and request in case of headers used.
  • Loading branch information
pcedelle authored Feb 14, 2017
2 parents 459b5d5 + 18c6d67 commit b6c9c08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/CALLR/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Client
*/
public function setURL($url)
{
trigger_error('setURL is deprecated. Do not change the URL (or extend client to be able to do so)', E_USER_DEPRECATED);
trigger_error('setURL is deprecated. Do not change the URL', E_USER_DEPRECATED);
$this->url = $url;
}

Expand Down
16 changes: 8 additions & 8 deletions src/CALLR/API/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ public function send(
/* curl */
$c = curl_init($url);

curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_FAILONERROR, true);
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($request));
curl_setopt($c, CURLOPT_FORBID_REUSE, false);

if ($auth instanceof AuthenticationInterface) {
$headers += array_values($auth->getHeaders());
$headers = array_merge($headers, array_values($auth->getHeaders()));
$auth->applyCurlOptions($c);
} elseif (!empty($auth)) {
trigger_error('Using a string for auth is deprecated, use a proper Authenticator instead', E_USER_DEPRECATED);
curl_setopt($c, CURLOPT_USERPWD, $auth);
}

curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_FAILONERROR, true);
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($request));
curl_setopt($c, CURLOPT_FORBID_REUSE, false);

if (is_string($proxy)) {
curl_setopt($c, CURLOPT_PROXY, $proxy);
}
Expand Down

0 comments on commit b6c9c08

Please sign in to comment.