Exemplo n.º 1
0
 public final function processResponse(Response $response)
 {
     ob_start();
     $this->printLayout($response->getContent());
     $fullHtml = ob_get_clean();
     $response->setContent($fullHtml);
 }
 protected function generateResponseForRequest($request = false)
 {
     if ($this->staticFile !== false) {
         $response = new Response();
         LayoutModule::disableLayout();
         if (substr($this->staticFile, -4) == ".css") {
             $mime = "text/css";
         } else {
             $info = new \finfo(FILEINFO_MIME);
             $mime = $info->file($this->staticFile);
         }
         if ($mime !== false) {
             if (substr($this->staticFile, -3) == ".js") {
                 $mime = str_replace("text/plain", "application/javascript", $mime);
             }
             HttpHeaders::setHeader("Content-type", $mime);
             $response->setHeader('Content-Type', $mime);
         }
         ob_start();
         readfile($this->staticFile);
         $response->setContent(ob_get_clean());
         return $response;
     }
     return false;
 }
Exemplo n.º 3
0
 public function testSend()
 {
     $string_content = "This is some string content";
     $this->response->setContent($string_content);
     ob_start();
     $this->response->send();
     $body = ob_get_clean();
     $this->assertEquals($body, $string_content, "Sent body did not equal set string content");
 }
Exemplo n.º 4
0
 public function formatContent()
 {
     if ($this->content != '' && !is_string($this->content)) {
         return SimpleXmlTranscoder::encode(parent::formatContent());
     }
     return parent::formatContent();
 }
 public function generateResponse($request = null)
 {
     $response = new Response();
     $response->setContent("bing bang bong");
     return $response;
 }
Exemplo n.º 6
0
 public function __construct($generator = null)
 {
     parent::__construct($generator);
     $this->setHeader('Content-Type', 'application/json');
 }