You are here

public function RestException::getResponseBody in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestException.php \Drupal\salesforce\Rest\RestException::getResponseBody()
  2. 8.3 src/Rest/RestException.php \Drupal\salesforce\Rest\RestException::getResponseBody()

Getter.

Return value

string|null The response body.

1 call to RestException::getResponseBody()
RestException::__construct in src/Rest/RestException.php
RestException constructor.

File

src/Rest/RestException.php, line 63

Class

RestException
Class RestException.

Namespace

Drupal\salesforce\Rest

Code

public function getResponseBody() {
  if ($this->body) {
    return $this->body;
  }
  if (!$this->response) {
    return NULL;
  }
  $body = $this->response
    ->getBody();
  if ($body) {
    $this->body = $body
      ->getContents();
    return $this->body;
  }
  return '';
}