mirror of
https://github.com/wallabag/wallabag.git
synced 2026-02-22 10:27:38 +01:00
Move the UA definition in HttpClientFactory before L67
This commit is contained in:
@ -64,6 +64,14 @@ class HttpClientFactory implements ClientFactory
|
||||
{
|
||||
$this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]);
|
||||
|
||||
if (!isset($config['defaults']['headers'])) {
|
||||
$config['defaults']['headers'] = [];
|
||||
}
|
||||
if (!isset($config['defaults']['headers']['User-Agent'])) {
|
||||
// need to set the user-agent
|
||||
$config['defaults']['headers']['User-Agent'] = $this->userAgent;
|
||||
}
|
||||
|
||||
if (0 === (int) $this->restrictedAccess) {
|
||||
return new GuzzleAdapter(new GuzzleClient($config));
|
||||
}
|
||||
@ -75,14 +83,6 @@ class HttpClientFactory implements ClientFactory
|
||||
$config['defaults']['cookies'] = $this->cookieJar;
|
||||
}
|
||||
|
||||
if (!isset($config['defaults']['headers'])) {
|
||||
$config['defaults']['headers'] = [];
|
||||
}
|
||||
if (!isset($config['defaults']['headers']['User-Agent'])) {
|
||||
// need to set the user-agent
|
||||
$config['defaults']['headers']['User-Agent'] = $this->userAgent;
|
||||
}
|
||||
|
||||
$guzzle = new GuzzleClient($config);
|
||||
foreach ($this->subscribers as $subscriber) {
|
||||
$guzzle->getEmitter()->attach($subscriber);
|
||||
|
||||
Reference in New Issue
Block a user