1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-26 18:21:02 +00:00

Make AuthenticatorProvider use Symfony HTTP Client

This commit is contained in:
Yassine Guedidi 2024-12-23 00:02:59 +01:00
parent c2197bd020
commit 1e1d58da7f
5 changed files with 47 additions and 20 deletions

View file

@ -2,21 +2,18 @@
namespace Wallabag\ExpressionLanguage;
use GuzzleHttp\ClientInterface;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class AuthenticatorProvider implements ExpressionFunctionProviderInterface
{
/**
* @var ClientInterface
*/
private $guzzle;
private HttpClientInterface $requestHtmlFunctionClient;
public function __construct(ClientInterface $guzzle)
public function __construct(HttpClientInterface $requestHtmlFunctionClient)
{
$this->guzzle = $guzzle;
$this->requestHtmlFunctionClient = $requestHtmlFunctionClient;
}
public function getFunctions(): array
@ -38,7 +35,7 @@ class AuthenticatorProvider implements ExpressionFunctionProviderInterface
throw new \Exception('Not supported');
},
function (array $arguments, $uri) {
return $this->guzzle->get($uri, $options)->getBody();
return $this->requestHtmlFunctionClient->request('GET', $uri)->getContent();
}
);
}