Only send "accept" headers on some HTTP methods

This commit is contained in:
Michael 2022-05-03 08:20:05 +00:00
parent 632a98965c
commit 690682a37e

View file

@ -140,7 +140,7 @@ class HttpClient implements ICanSendHttpRequests
}
};
if (empty($conf[HttpClientOptions::HEADERS]['Accept'])) {
if (empty($conf[HttpClientOptions::HEADERS]['Accept']) && in_array($method, ['get', 'head'])) {
$this->logger->info('Accept header was missing, using default.', ['url' => $url, 'callstack' => System::callstack()]);
$conf[HttpClientOptions::HEADERS]['Accept'] = HttpClientAccept::DEFAULT;
}