Example #1
0
 public function testModifiingBody()
 {
     self::assertNull($this->response->getBody());
     $this->response->appendToBody('foo');
     self::assertEquals('foo', $this->response->getBody());
     $this->response->appendToBody('bar');
     self::assertEquals('foobar', $this->response->getBody());
     $this->response->setBody('baz');
     self::assertEquals('baz', $this->response->getBody());
 }
Example #2
0
 public function update(\Nano\Controller\Response $response)
 {
     $contents = $response->getBody();
     $response->setBody('<h1>Unexpected Error</h1>');
     $response->appendToBody($contents);
 }
Example #3
0
 protected function appendOutput(\Nano\Controller\Response $response, $buffer)
 {
     if (0 != strLen($buffer)) {
         $response->appendToBody('<hr />' . PHP_EOL);
         $response->appendToBody('Generated output: <pre>' . htmlSpecialChars($buffer) . '</pre>');
     }
 }