public function setContentType($type) { if ($this->_contentTypeHeaderSent) { throw new \Exception('Unable to alter content-type as it has been already sent'); } $this->_contentType = $type; }
public function testSetContentType() { $response = new THttpResponse(); $response->init(null); $response->setContentType('image/jpeg'); self::assertEquals('image/jpeg', $response->getContentType()); $response->setContentType('text/plain'); self::assertEquals('text/plain', $response->getContentType()); }