public function toArray()
{
$body = $this->getBody();
// Base64 encode when binary
if (strpos($this->getContentType(), 'application/x-gzip') !== false || $this->getHeader('Content-Transfer-Encoding') == 'binary') {
$body = base64_encode($body);
}
return array_filter(array('status' => $this->status, 'headers' => $this->getHeaders(), 'body' => $body));
}