Пример #1
0
 public function testHeaders()
 {
     $response = new Response();
     $this->assertEquals(['Access-Control-Allow-Origin' => ['*'], 'Connection' => ['close'], 'Content-Type' => ['text/plain']], $response->getHeaders());
     $response = new Response('php://memory', 200, ['Content-Type' => ['application/json']]);
     $this->assertEquals(['Access-Control-Allow-Origin' => ['*'], 'Connection' => ['close'], 'Content-Type' => ['application/json']], $response->getHeaders());
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function send()
 {
     // Disable gzip compression on Apache configurations
     if (function_exists('apache_setenv')) {
         apache_setenv('no-gzip', '1');
     }
     parent::send();
 }
Пример #3
0
 /**
  * @param integer|null $maxSize
  * @param integer $status
  * @param array $headers
  */
 public function __construct($maxSize = null, $status = 409, array $headers = [])
 {
     parent::__construct('php://memory', $status, $headers);
     $body = $this->getBody();
     $body->write("Conflict: The requested size is superior to the internal limit");
     if ($maxSize !== null) {
         $body->write(" ({$maxSize})");
     }
 }
Пример #4
0
 /**
  * @param integer $status
  * @param array $headers
  */
 public function __construct($status = 204, array $headers = [])
 {
     $body = new Stream('php://temp', 'r');
     parent::__construct($body, $status, $headers);
 }