mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
feat(guzzle): allow overriding the default curl handler when creating a new client
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
0c3f22eb4b
commit
04dc699a29
2 changed files with 6 additions and 4 deletions
|
|
@ -41,9 +41,9 @@ class ClientService implements IClientService {
|
|||
}
|
||||
|
||||
#[\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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@ namespace OCP\Http\Client;
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue