diff --git a/lib/private/Http/Client/ClientService.php b/lib/private/Http/Client/ClientService.php index 8df3d3ed193bc..385a49f5a60ae 100644 --- a/lib/private/Http/Client/ClientService.php +++ b/lib/private/Http/Client/ClientService.php @@ -41,9 +41,9 @@ public function __construct( } #[\Override] - public function newClient(): IClient { - $handler = new CurlHandler(); - $stack = HandlerStack::create($handler); + public function newClient(?callable $handler = null): IClient { + $clientHandler = $handler ?? new CurlHandler(); + $stack = HandlerStack::create($clientHandler); if ($this->config->getSystemValueBool('dns_pinning', true)) { $stack->push($this->dnsPinMiddleware->addDnsPinning()); } diff --git a/lib/public/Http/Client/IClientService.php b/lib/public/Http/Client/IClientService.php index 12edf3dcf840e..7c853dbbe90a7 100644 --- a/lib/public/Http/Client/IClientService.php +++ b/lib/public/Http/Client/IClientService.php @@ -16,8 +16,10 @@ */ interface IClientService { /** + * @param ?callable $handler Handler that overrides the default CurlHandler * @return IClient * @since 8.1.0 + * @since 35.0.0 Added $handler optional param */ - public function newClient(): IClient; + public function newClient(?callable $handler = null): IClient; }