You are here

public function Response::__toString in RESTful 7.2

Returns the Response as an HTTP string.

The string representation of the Response is the same as the one that will be sent to the client only if the prepare() method has been called before.

Return value

string The Response as an HTTP string

See also

prepare()

File

src/Http/Response.php, line 163
Contains \Drupal\restful\Http\Response.

Class

Response

Namespace

Drupal\restful\Http

Code

public function __toString() {
  return sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText) . "\r\n" . $this->headers . "\r\n" . $this
    ->getContent();
}