/** * @param string $httpMethod * @param string $url * @return Request */ private function createRequest($httpMethod, $url) { $request = new Request($httpMethod); $request->setHeaders($this->headers); $request->fromUrl($url); return $request; }
/** * @param string $httpMethod * @param string $url * @param array $parameters * @param array $headers * @param array $files * * @return FormRequest|Request */ private function createRequest($httpMethod, $url, array $parameters, array $headers, array $files) { if (empty($files)) { $request = new Request($httpMethod); $request->setContent(http_build_query($parameters)); } else { $request = new FormRequest($httpMethod); foreach ($parameters as $name => $value) { $request->setField($name, $value); } foreach ($files as $name => $file) { $upload = new FormUpload($file); $request->setField($name, $upload); } } $request->setHeaders($this->headers); $request->fromUrl($url); $request->addHeaders($headers); return $request; }