mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +02:00
refactor: return proper response object (#4169)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user