Skip to content

Commit

Permalink
Add HttpClientDiscovery support
Browse files Browse the repository at this point in the history
Allow to perform a dynamic client resolution based on the current context.
Require the puli composer extension to be registered : https://php-http.readthedocs.org/en/latest/discovery.html#installation
  • Loading branch information
shulard committed Apr 4, 2016
1 parent 2a93194 commit 46aca35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use GuzzleHttp\Psr7\Response;
use Http\Client\HttpClient;
use Http\Message\MessageFactory;
use Http\Discovery\HttpClientDiscovery;

/**
* Wrapper to manage login and exchanges with simpliest Ovh API
Expand Down Expand Up @@ -382,6 +383,10 @@ public function getConsumerKey()
*/
public function getHttpClient()
{
if ($this->http_client === null) {
$this->http_client = HttpClientDiscovery::find();
}

return $this->http_client;
}

Expand Down

0 comments on commit 46aca35

Please sign in to comment.