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:
parent
fff94563d7
commit
933ea7c9ce
11 changed files with 96 additions and 28 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue