Update src/Network/GuzzleResponse.php

This commit is contained in:
Philipp Holzer 2021-08-20 19:48:23 +02:00
parent 756f57f198
commit a338e4cbff
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD

View file

@ -89,12 +89,7 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
public function getContentType() public function getContentType()
{ {
$contentTypes = $this->getHeader('Content-Type') ?? []; $contentTypes = $this->getHeader('Content-Type') ?? [];
$countTypes = count($contentTypes); return array_pop($contentTypes) ?? '';
if ($countTypes > 0) {
return $contentTypes[$countTypes - 1];
} else {
return '';
}
} }
/** {@inheritDoc} */ /** {@inheritDoc} */