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()); }
/** * {@inheritdoc} */ public function send() { // Disable gzip compression on Apache configurations if (function_exists('apache_setenv')) { apache_setenv('no-gzip', '1'); } parent::send(); }
/** * @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})"); } }
/** * @param integer $status * @param array $headers */ public function __construct($status = 204, array $headers = []) { $body = new Stream('php://temp', 'r'); parent::__construct($body, $status, $headers); }