/**
  * @param  Request  $request
  * @return Response
  */
 public function request(Request $request)
 {
     $headers = new Headers();
     $headers->addHeaders($request->getHeaders());
     $zendRequest = new ZendRequest();
     $zendRequest->setVersion($request->getProtocolVersion());
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setUri((string) $request->getUrl());
     $zendRequest->setHeaders($headers);
     $zendRequest->setContent($request->getContent());
     /** @var ZendResponse $zendResponse */
     $zendResponse = $this->client->send($zendRequest);
     return new Response((string) $zendResponse->getVersion(), $zendResponse->getStatusCode(), $zendResponse->getReasonPhrase(), $zendResponse->getHeaders()->toArray(), $zendResponse->getContent());
 }
Ejemplo n.º 2
0
 public function testRequestSetVersionWillThrowExceptionOnInvalidArgument()
 {
     $request = new Request();
     $this->setExpectedException('Zend\\Http\\Exception\\InvalidArgumentException', 'Not valid or not supported HTTP version');
     $request->setVersion('1.2');
 }
Ejemplo n.º 3
0
    public function testRequestSetVersionWillThrowExceptionOnInvalidArgument()
    {
        $request = new Request();

        $this->setExpectedException('Zend\Http\Exception\InvalidArgumentException', 'not a valid version');
        $request->setVersion('1.2');
    }