Request type set for all HTTP requests

This commit is contained in:
Michael 2024-05-12 17:53:21 +00:00
parent d788cb82cc
commit 5751e024c0
30 changed files with 129 additions and 90 deletions

View file

@ -24,6 +24,8 @@ namespace Friendica\Core;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
use Friendica\Network\HTTPException;
use Friendica\Object\Search\ContactResult;
use Friendica\Object\Search\ResultList;
@ -125,7 +127,7 @@ class Search
$searchUrl .= '&page=' . $page;
}
$resultJson = DI::httpClient()->fetch($searchUrl, HttpClientAccept::JSON);
$resultJson = DI::httpClient()->fetch($searchUrl, HttpClientAccept::JSON, 0, '', HttpClientRequest::CONTACTDISCOVER);
$results = json_decode($resultJson, true);
@ -232,7 +234,7 @@ class Search
$return = Contact::searchByName($search, $mode, true);
} else {
$p = $page > 1 ? 'p=' . $page : '';
$curlResult = DI::httpClient()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), HttpClientAccept::JSON);
$curlResult = DI::httpClient()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), HttpClientAccept::JSON, [HttpClientOptions::REQUEST => HttpClientRequest::CONTACTDISCOVER]);
if ($curlResult->isSuccess()) {
$searchResult = json_decode($curlResult->getBodyString(), true);
if (!empty($searchResult['profiles'])) {