Move ACCEPT constants to own "enum" class

This commit is contained in:
Philipp 2022-04-02 20:26:11 +02:00
parent c700645385
commit 73c3b21665
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
35 changed files with 144 additions and 138 deletions

View file

@ -25,7 +25,7 @@ use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\GServer;
use Friendica\Network\HTTPClient\Client\HttpClient;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Util\Strings;
@ -37,7 +37,7 @@ class UpdateServerPeers
*/
public static function execute(string $url)
{
$ret = DI::httpClient()->get($url . '/api/v1/instance/peers', [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_JSON]);
$ret = DI::httpClient()->get($url . '/api/v1/instance/peers', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON]);
if (!$ret->isSuccess() || empty($ret->getBody())) {
Logger::info('Server is not reachable or does not offer the "peers" endpoint', ['url' => $url]);
return;