Revert "Fix IHTTPResult::getHeader/s() - Split functionality "getHeader()" and "getHeaders()" analog to IMessageInterface::getHeader/s() - Fix functionality at various places - Adapt CurlResultTest"
This reverts commit 933ea7c9
This commit is contained in:
parent
4b59fe4cf7
commit
069753416d
11 changed files with 28 additions and 96 deletions
|
@ -242,29 +242,23 @@ class CurlResult implements IHTTPResult
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function getHeader($header)
|
||||
public function getHeader(string $field = '')
|
||||
{
|
||||
if (empty($header)) {
|
||||
return '';
|
||||
if (empty($field)) {
|
||||
return $this->header;
|
||||
}
|
||||
|
||||
$header = strtolower(trim($header));
|
||||
$field = strtolower(trim($field));
|
||||
|
||||
$headers = $this->getHeaderArray();
|
||||
|
||||
if (isset($headers[$header])) {
|
||||
return $headers[$header];
|
||||
if (isset($headers[$field])) {
|
||||
return $headers[$field];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->getHeaderArray();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function inHeader(string $field)
|
||||
{
|
||||
|
|
|
@ -465,7 +465,8 @@ class HTTPRequest implements IHTTPRequest
|
|||
'timeout' => $timeout,
|
||||
'accept_content' => $accept_content,
|
||||
'cookiejar' => $cookiejar
|
||||
]
|
||||
],
|
||||
$redirects
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Friendica\Network;
|
||||
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
|
||||
/**
|
||||
* Temporary class to map Friendica used variables based on PSR-7 HTTPResponse
|
||||
*/
|
||||
|
@ -25,25 +23,15 @@ interface IHTTPResult
|
|||
|
||||
/**
|
||||
* Returns the headers
|
||||
* @see MessageInterface::getHeader()
|
||||
*
|
||||
* @param string $header optional header field. Return all fields if empty
|
||||
* @param string $field optional header field. Return all fields if empty
|
||||
*
|
||||
* @return string the headers or the specified content of the header variable
|
||||
*/
|
||||
public function getHeader($header);
|
||||
|
||||
/**
|
||||
* Returns all headers
|
||||
* @see MessageInterface::getHeaders()
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function getHeaders();
|
||||
public function getHeader(string $field = '');
|
||||
|
||||
/**
|
||||
* Check if a specified header exists
|
||||
* @see MessageInterface::hasHeader()
|
||||
*
|
||||
* @param string $field header field
|
||||
*
|
||||
|
@ -53,10 +41,8 @@ interface IHTTPResult
|
|||
|
||||
/**
|
||||
* Returns the headers as an associated array
|
||||
* @see MessageInterface::getHeaders()
|
||||
* @deprecated
|
||||
*
|
||||
* @return string[][] associated header array
|
||||
* @return array associated header array
|
||||
*/
|
||||
public function getHeaderArray();
|
||||
|
||||
|
@ -76,8 +62,6 @@ interface IHTTPResult
|
|||
public function getRedirectUrl();
|
||||
|
||||
/**
|
||||
* @see MessageInterface::getBody()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBody();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue