diff options
author | 2024-07-31 17:30:06 +0200 | |
---|---|---|
committer | 2024-07-31 17:30:06 +0200 | |
commit | 891c8979a3ea7678b61d62fbe7f69250d32d1c78 (patch) | |
tree | 7e3ffb6ade7708be2967dc7af93d2ba6131aea38 /lib | |
parent | aa3989873cbcd20919725e847e4d299ee5724740 (diff) | |
download | rss-bridge-891c8979a3ea7678b61d62fbe7f69250d32d1c78.tar.gz rss-bridge-891c8979a3ea7678b61d62fbe7f69250d32d1c78.tar.zst rss-bridge-891c8979a3ea7678b61d62fbe7f69250d32d1c78.zip |
refactor: return proper response object (#4169)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/contents.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/contents.php b/lib/contents.php index ba6dd531..893a3512 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -5,8 +5,8 @@ * * @param array $httpHeaders E.g. ['Content-type: text/plain'] * @param array $curlOptions Associative array e.g. [CURLOPT_MAXREDIRS => 3] - * @param bool $returnFull Whether to return an array: ['code' => int, 'headers' => array, 'content' => string] - * @return string|array + * @param bool $returnFull Whether to return Response object + * @return string|Response */ function getContents( string $url, @@ -113,13 +113,7 @@ function getContents( throw $e; } if ($returnFull === true) { - // todo: return the actual response object - return [ - 'code' => $response->getCode(), - 'headers' => $response->getHeaders(), - // For legacy reasons, use 'content' instead of 'body' - 'content' => $response->getBody(), - ]; + return $response; } return $response->getBody(); } |