Exemplo n.º 1
0
 /**
  * @test
  */
 public function getHeader_return_default_for_nonexistent_key()
 {
     $response = new HttpResponse(200, '', array('Location' => 'somewhere'));
     $this->assertNull($response->getHeader('nonexistent'));
     $this->assertEquals('somevalue', $response->getHeader('somekey', 'somevalue'));
 }
Exemplo n.º 2
0
 protected function createResponse(array $bundle, array $kwargs = array())
 {
     $contentType = $this->detectSupportedContentType($bundle['request']);
     $this->applySerializationOn($bundle, $contentType);
     $statusCode = getattr($kwargs['statusCode'], 200);
     $headers = getattr($kwargs['headers'], array());
     $content = getattr($bundle['data'], '');
     $response = new HttpResponse($statusCode, $content, $headers);
     $response->setContentType($contentType);
     return $response;
 }