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()); }
public function update(\Nano\Controller\Response $response) { $contents = $response->getBody(); $response->setBody('<h1>Unexpected Error</h1>'); $response->appendToBody($contents); }
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>'); } }