/** * Prepare a solarium response from the given request and client * response * * @throws HttpException * @param Request $request * @param \Zend_Http_Response $response * @return Response */ protected function prepareResponse($request, $response) { if ($response->isError()) { throw new HttpException($response->getMessage(), $response->getStatus()); } if ($request->getMethod() == Request::METHOD_HEAD) { $data = ''; } else { $data = $response->getBody(); } // this is used because getHeaders doesn't return the HTTP header... $headers = explode("\n", $response->getHeadersAsString()); return new Response($data, $headers); }