diff --git a/src/Lifecycle.php b/src/Lifecycle.php index 313f75fe..0f583260 100644 --- a/src/Lifecycle.php +++ b/src/Lifecycle.php @@ -55,6 +55,7 @@ class Lifecycle implements MiddlewareInterface { */ public function start(bool $render = true):ResponseInterface { ini_set("display_errors", true); + ob_start(); $server = new ServerInfo($_SERVER); $cwd = dirname($server->getDocumentRoot()); @@ -114,7 +115,7 @@ public function start(bool $render = true):ResponseInterface { $csrfProtection = new SessionTokenStore( $sessionHandler->getStore( "gt.csrf", - true + true ) ); @@ -169,7 +170,8 @@ public function start(bool $render = true):ResponseInterface { } } - return $this->finish($response, $render); + $buffer = ob_get_clean(); + return $this->finish($response, $buffer, $render); } /** @@ -282,6 +284,7 @@ public function process( */ public static function finish( ResponseInterface $response, + string $buffer = "", bool $render = true ):ResponseInterface { http_response_code($response->getStatusCode()); @@ -290,6 +293,7 @@ public static function finish( } if($render) { + echo $buffer; echo $response->getBody(); }