]> git.mxchange.org Git - friendica.git/blobdiff - src/Network/GuzzleResponse.php
Add suggestions
[friendica.git] / src / Network / GuzzleResponse.php
index 72d87ae9fe94d1ec8145391fd0322efe999d0639..3b41f6f6540f18d1838eed48020b6cd12eebafc9 100644 (file)
@@ -68,7 +68,7 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
                }
 
                if (!$this->isSuccess) {
-                       Logger::notice('http error', ['url' => $this->url, 'code' => $this->getReturnCode(), 'error'  => $this->error, 'callstack' => System::callstack(20)]);
+                       Logger::notice('http error', ['url' => $this->url, 'code' => $this->getReturnCode(), 'error' => $this->error, 'callstack' => System::callstack(20)]);
                        Logger::debug('debug', ['info' => $this->getHeaders()]);
                }
 
@@ -88,7 +88,8 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
        /** {@inheritDoc} */
        public function getContentType()
        {
-               return implode($this->getHeader('Content-Type'));
+               $contentTypes = $this->getHeader('Content-Type') ?? [];
+               return array_pop($contentTypes) ?? '';
        }
 
        /** {@inheritDoc} */
@@ -144,4 +145,10 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
        {
                return $this->isTimeout;
        }
+
+       /// @todo - fix mismatching use of "getBody()" as string here and parent "getBody()" as streaminterface
+       public function getBody(): string
+       {
+               return (string) parent::getBody();
+       }
 }