1
0
Fork 0

Fix IHTTPResult::getHeader/s()

- Split functionality "getHeader()" and "getHeaders()" analog to IMessageInterface::getHeader/s()
- Fix functionality at various places
- Adapt CurlResultTest
This commit is contained in:
Philipp Holzer 2020-10-09 19:33:19 +02:00
commit 933ea7c9ce
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
11 changed files with 96 additions and 28 deletions

View file

@ -242,23 +242,29 @@ class CurlResult implements IHTTPResult
}
/** {@inheritDoc} */
public function getHeader(string $field = '')
public function getHeader($header)
{
if (empty($field)) {
return $this->header;
if (empty($header)) {
return '';
}
$field = strtolower(trim($field));
$header = strtolower(trim($header));
$headers = $this->getHeaderArray();
if (isset($headers[$field])) {
return $headers[$field];
if (isset($headers[$header])) {
return $headers[$header];
}
return '';
}
/** {@inheritDoc} */
public function getHeaders()
{
return $this->getHeaderArray();
}
/** {@inheritDoc} */
public function inHeader(string $field)
{