From 317de3c12299a357357280af1f175bdfe38f019b Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 22 May 2026 04:00:06 +0300 Subject: [PATCH] Fix: Add html() method to Response class --- backend/app/Core/Response.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backend/app/Core/Response.php b/backend/app/Core/Response.php index bd4af8d..58c2af7 100644 --- a/backend/app/Core/Response.php +++ b/backend/app/Core/Response.php @@ -58,6 +58,25 @@ class Response exit; } + /** + * Send HTML response and terminate execution + * + * @param string $html + * @param int $code + * @return void + */ + public function html(string $html, int $code = 200): void + { + $this->setStatusCode($code); + $this->setHeader('Content-Type', 'text/html; charset=utf-8'); + + $this->sendHeaders(); + http_response_code($this->statusCode); + + echo $html; + exit; + } + /** * Send success JSON response */