Commit efd4da3a authored by alexpott's avatar alexpott

Issue #2401159 by kim.pepper, Jaesin: Convert instances of Guzzle getBody(TRUE)

parent fa3fc447
......@@ -1364,8 +1364,8 @@ function install_retrieve_file($uri, $destination) {
}
try {
$request = \Drupal::httpClient()->get($uri, array('headers' => array('Accept' => 'text/plain')));
$data = $request->getBody(TRUE);
$response = \Drupal::httpClient()->get($uri, array('headers' => array('Accept' => 'text/plain')));
$data = (string) $response->getBody();
if (empty($data)) {
return FALSE;
}
......
......@@ -122,7 +122,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// @todo Move this to a fetcher implementation.
try {
$response = $this->httpClient->get($form_state->getValue('remote'));
$data = $response->getBody(TRUE);
$data = (string) $response->getBody();
}
catch (RequestException $e) {
$this->logger('aggregator')->warning('Failed to download OPML file due to "%error".', array('%error' => $e->getMessage()));
......
......@@ -64,7 +64,7 @@ public function normalize($entity, $format = NULL, array $context = array()) {
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = array()) {
$file_data = $this->httpClient->get($data['uri'][0]['value'])->getBody(TRUE);
$file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody();
$path = 'temporary://' . drupal_basename($data['uri'][0]['value']);
$data['uri'] = file_unmanaged_save_data($file_data, $path);
......
......@@ -1361,9 +1361,9 @@ function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $repl
}
}
try {
$data = \Drupal::httpClient()
$data = (string) \Drupal::httpClient()
->get($url)
->getBody(TRUE);
->getBody();
$local = $managed ? file_save_data($data, $path, $replace) : file_unmanaged_save_data($data, $path, $replace);
}
catch (RequestException $exception) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment