Cleanup Utils #467 (#547)

* Remove Utils Facade
This commit is contained in:
Nabeel S
2020-02-11 12:32:41 -05:00
committed by GitHub
parent be6c164f03
commit b36a3009dd
27 changed files with 281 additions and 289 deletions

View File

@@ -55,10 +55,18 @@ class HttpClient
*/
public function download($uri, $local_path)
{
$response = $this->httpClient->request('GET', $uri, [
'sink' => $local_path,
]);
$opts = [];
if ($local_path !== null) {
$opts['sink'] = $local_path;
}
return $response;
$response = $this->httpClient->request('GET', $uri, $opts);
$body = $response->getBody()->getContents();
if ($response->getHeader('content-type') === 'application/json') {
$body = \GuzzleHttp\json_decode($body);
}
return $body;
}
}