/**
  * @param  Request     $request
  * @return BuzzRequest
  */
 protected function prepareRequest(Request $request)
 {
     $buzzRequest = new BuzzRequest($request->getMethod(), $request->getUrl()->getResource(), $request->getUrl()->getHost());
     $buzzRequest->setProtocolVersion($request->getProtocolVersion());
     $buzzRequest->setHeaders(HeaderConverter::convertAssociativeToRaw($this->prepareHeaders($request)));
     $buzzRequest->setContent($request->getContent());
     return $buzzRequest;
 }
 /**
  * @param  Request  $request
  * @return Response
  */
 public function request(Request $request)
 {
     $method = strtolower($request->getMethod());
     $headers = HeaderConverter::convertAssociativeToRaw($this->prepareHeaders($request));
     /** @var VinelabResponse $vinelabResponse */
     $vinelabResponse = $this->client->{$method}(array('version' => $request->getProtocolVersion(), 'url' => (string) $request->getUrl(), 'headers' => $headers, 'content' => $request->getContent()));
     return new Response($request->getProtocolVersion(), $vinelabResponse->statusCode(), $this->getStatusMessage($vinelabResponse->statusCode()), $vinelabResponse->headers(), $vinelabResponse->content());
 }
 /**
  * @param array $associativeHeaders
  * @param array $expected
  * @dataProvider convertAssociativeToRawProvider
  */
 public function testConvertAssociativeToRaw(array $associativeHeaders, array $expected)
 {
     $actual = HeaderConverter::convertAssociativeToRaw($associativeHeaders);
     $this->assertEquals($expected, $actual);
 }