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
2021-08-20 19:48:14 +02:00
parent a60ca4a1cf
commit dee1899628
10 changed files with 89 additions and 22 deletions
+12 -6
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)
{