Example #1
0
 /**
  * @param string $token
  * @param Route $route
  * @return Request
  * @throws \InvalidArgumentException
  */
 protected function prepareRequest(string $token, Route $route)
 {
     $headers = $this->prepareHeaders($token);
     if ($route->getBody() !== null && $route->method() === 'GET') {
         throw new \InvalidArgumentException('GET requests can not contain a body');
     }
     return new Request($route->method(), $route->build(), $headers, $route->getBody(), '1.1');
 }