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 2020-10-09 19:33:19 +02:00
parent fff94563d7
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

@ -90,12 +90,13 @@ function parse_url_content(App $a)
if ($curlResponse->isSuccess()) {
// Convert the header fields into an array
$hdrs = [];
$h = explode("\n", $curlResponse->getHeader());
$h = $curlResponse->getHeaders();
foreach ($h as $l) {
$header = array_map('trim', explode(':', trim($l), 2));
if (count($header) == 2) {
list($k, $v) = $header;
$hdrs[$k] = $v;
foreach ($l as $k => $v) {
if (empty($hdrs[$k])) {
$hdrs[$k] = $v;
}
$hdrs[$k] .= " " . $v;
}
}
$type = null;