]> git.mxchange.org Git - friendica.git/blobdiff - src/Network/GuzzleResponse.php
Add suggestions
[friendica.git] / src / Network / GuzzleResponse.php
index c6cab7c9e8742fc5394112599fea69ae6e5fe978..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 $this->getHeader('Content-Type');
+               $contentTypes = $this->getHeader('Content-Type') ?? [];
+               return array_pop($contentTypes) ?? '';
        }
 
        /** {@inheritDoc} */
@@ -121,11 +122,6 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
                return $this->url;
        }
 
-       public function getInfo()
-       {
-               // TODO: Implement getInfo() method.
-       }
-
        /** {@inheritDoc} */
        public function isRedirectUrl()
        {
@@ -149,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();
+       }
 }