use Friendica\Network\IHTTPClient;
use Friendica\Util\Profiler;
use GuzzleHttp\Client;
+use GuzzleHttp\HandlerStack;
use GuzzleHttp\RequestOptions;
use mattwright\URLResolver;
use Psr\Http\Message\RequestInterface;
$this->baseUrl = $baseUrl;
}
- public function createClient(): IHTTPClient
+ /**
+ * Creates a IHTTPClient for communications with HTTP endpoints
+ *
+ * @param HandlerStack|null $handlerStack (optional) A handler replacement (just usefull at test environments)
+ *
+ * @return IHTTPClient
+ */
+ public function createClient(HandlerStack $handlerStack = null): IHTTPClient
{
$proxy = $this->config->get('system', 'proxy');
RequestOptions::HEADERS => [
'User-Agent' => $userAgent,
],
+ 'handler' => $handlerStack ?? HandlerStack::create(),
]);
$resolver = new URLResolver();