/** * Handle the Response response * @param Response $response * @throws Exception * @return void */ private function handleResponse(Response $response) { $location = $response->getLocation(); if (!empty($location)) { Http::header(Http::HEADER_LOCATION, $location); exit; } $headers = $response->getHeaders(); foreach ($headers as $header) { Http::header($header[0], $header[1]); } Http::status($response->getStatus()); $body = $response->getBody(); if (!empty($body)) { echo $body; } exit; }