Skip to content

Commit

Permalink
Merge pull request #110 from tobiasbambullis/fix/dynamic-curl-options
Browse files Browse the repository at this point in the history
feat/dynamic curl options
  • Loading branch information
edamov authored Jan 19, 2021
2 parents 9d7d149 + aa77a12 commit 9078598
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,25 @@ class Client
* @var resource
*/
private $curlMultiHandle;

/**
* options for curl
*
* @var resource
*/
private $curlOptions = array();

/**
* Client constructor.
*
* @param AuthProviderInterface $authProvider
* @param bool $isProductionEnv
*/
public function __construct(AuthProviderInterface $authProvider, bool $isProductionEnv = false)
public function __construct(AuthProviderInterface $authProvider, bool $isProductionEnv = false, array $curlOptions = array())
{
$this->authProvider = $authProvider;
$this->isProductionEnv = $isProductionEnv;
$this->curlOptions = $curlOptions;
}

/**
Expand Down Expand Up @@ -187,7 +195,7 @@ private function prepareHandle(Notification $notification)

$this->authProvider->authenticateClient($request);

curl_setopt_array($ch, $request->getOptions());
curl_setopt_array($ch, $this->curlOptions + $request->getOptions());
curl_setopt($ch, CURLOPT_HTTPHEADER, $request->getDecoratedHeaders());

// store device token to identify response
Expand Down

1 comment on commit 9078598

@oriolpons-everis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change causes the url to be misreported in curl and throws the following error: no url set!

Please sign in to comment.