/**
  * The Content-Length: 0 header is sent with the request even though
  * the request has no body.
  */
 public function testContentLengthHeaderExists()
 {
     $client = new HotelClient(new Client(), new Description(['operations' => ['PostReservation' => ['httpMethod' => 'post']]]));
     $client->getEmitter()->attach(new ContentLength());
     $mock = new Mock([new Response(200)]);
     $history = new History();
     $client->getHttpClient()->getEmitter()->attach($mock);
     $client->getHttpClient()->getEmitter()->attach($history);
     $command = $client->getCommand('PostReservation');
     $client->execute($command);
     $request = $history->getLastRequest();
     $this->assertArrayHasKey('Content-Length', $request->getHeaders());
     $this->assertEquals('0', $request->getHeader('Content-Length'));
 }
 public function testResponseDoesNotHaveCacheControl()
 {
     $maxAge = 335;
     $matchPaths = ['/ean-services/rs/hotel/v3/info'];
     $client = new HotelClient(new Client(), new Description(['operations' => ['GetHotelList' => ['httpMethod' => 'GET', 'uri' => '/ean-services/rs/hotel/v3/list']]]));
     $client->getHttpClient()->getEmitter()->attach(new CacheControl($maxAge, $matchPaths));
     $mock = new Mock([new Response(200)]);
     $history = new History();
     $client->getHttpClient()->getEmitter()->attach($mock);
     $client->getHttpClient()->getEmitter()->attach($history);
     $command = $client->getCommand('GetHotelList');
     $client->execute($command);
     $response = $history->getLastResponse();
     $this->assertArrayNotHasKey('Cache-Control', $response->getHeaders());
 }