public function request($path, array $params = [])
{
if (!$this->guzzle instanceof Guzzle) {
throw new BaseUrlException('BaseUrl was never set. Please call baseUrl($url).');
}
$uri = $path . '?' . http_build_query($params);
$response = $this->guzzle->get($uri, ['timeout' => $this->timeout, 'http_errors' => false]);
$body = $response->getBody();
$code = $response->getStatusCode();
$headers = $response->getHeaders();
if ($body instanceof Stream) {
$body->seek(0);
$content = $body->getSize() > 0 ? $body->read($body->getSize()) : null;
} else {
// no content
$content = '';
}
$response = new Response($content, $code, $headers);
return $response;
}