/** * @param string $method * @param bool $hasBody * * @return \Unirest\Response */ protected function send($method = 'get', $hasBody = false) { if ($this->customBody) { $response = $this->request->{$method}($this->url(), $this->headers, $this->customBody); } elseif ($hasBody) { $response = $this->request->{$method}($this->url(), $this->headers, $this->resource->encode()); } else { $response = $this->request->{$method}($this->url(), $this->headers); } return $response; }