aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2024-07-31 17:30:06 +0200
committerGravatar GitHub <noreply@github.com> 2024-07-31 17:30:06 +0200
commit891c8979a3ea7678b61d62fbe7f69250d32d1c78 (patch)
tree7e3ffb6ade7708be2967dc7af93d2ba6131aea38 /lib
parentaa3989873cbcd20919725e847e4d299ee5724740 (diff)
downloadrss-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.php12
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();
}