Fixup HTTP headers for httpClient requests

This commit is contained in:
Philipp 2021-08-24 14:17:42 +02:00
parent c7f54d83ce
commit 2356221aba
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
12 changed files with 36 additions and 33 deletions

View file

@ -1728,8 +1728,7 @@ class GServer
if (!empty($accesstoken)) {
$api = 'https://instances.social/api/1.0/instances/list?count=0';
$header = ['Authorization: Bearer '.$accesstoken];
$curlResult = DI::httpRequest()->get($api, ['header' => $header]);
$curlResult = DI::httpRequest()->get($api, ['header' => ['Authorization' => ['Bearer ' . $accesstoken]]]);
if ($curlResult->isSuccess()) {
$servers = json_decode($curlResult->getBody(), true);

View file

@ -50,7 +50,7 @@ class ExternalResource implements IStorage
}
try {
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, ['accept_content' => '']);
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, ['accept_content' => []]);
} catch (Exception $exception) {
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $exception->getCode(), $exception);
}