Skip to content

Commit 46aca35

Browse files
committed
Add HttpClientDiscovery support
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
1 parent 2a93194 commit 46aca35

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Api.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use GuzzleHttp\Psr7\Response;
3838
use Http\Client\HttpClient;
3939
use Http\Message\MessageFactory;
40+
use Http\Discovery\HttpClientDiscovery;
4041

4142
/**
4243
* Wrapper to manage login and exchanges with simpliest Ovh API
@@ -382,6 +383,10 @@ public function getConsumerKey()
382383
*/
383384
public function getHttpClient()
384385
{
386+
if ($this->http_client === null) {
387+
$this->http_client = HttpClientDiscovery::find();
388+
}
389+
385390
return $this->http_client;
386391
}
387392

0 commit comments

Comments
 (0)