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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user