* @param string $accept content-type to accept
* @return array content type
*/
- public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT)
+ public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT): array
{
- $curlResult = DI::httpClient()->head($url, $accept);
+ $curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => $accept]);
// Workaround for systems that can't handle a HEAD request
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
}
if (!$curlResult->isSuccess()) {
+ Logger::debug('Got HTTP Error', ['http error' => $curlResult->getReturnCode(), 'url' => $url]);
return [];
}