From 947b86368c764afa5d3d5acfd96346a3ec93ddbb Mon Sep 17 00:00:00 2001 From: Abdulbasit Rubeiyya Date: Mon, 1 Jan 2024 19:04:52 +0300 Subject: [PATCH] Http error codes for 404 and client Error - 400 - `\Leaf\Exception\General::default404();` was providing a custom error page for not found asset but did not return the HTTP error code 404 - \Leaf\Exception\General::csrf(); was not returning any error code when csrf had expired --- src/Exception/General.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Exception/General.php b/src/Exception/General.php index 636ac5a8..a2bba59d 100755 --- a/src/Exception/General.php +++ b/src/Exception/General.php @@ -200,9 +200,12 @@ public static function defaultDown() */ public static function default404() { - echo static::errorMarkup( - '404', - '

The page you are looking for could not be found.

' + (new \Leaf\Http\Response())->exit( + static::errorMarkup( + '404', + '

The page you are looking for could not be found.

' + ), + 404 ); } @@ -211,9 +214,12 @@ public static function default404() */ public static function csrf($error = null) { - echo static::errorMarkup( - 'Invalid request', - "

$error

" ?? '

The page you are looking for has expired.

' + (new \Leaf\Http\Response())->exit( + static::errorMarkup( + 'Invalid request', + "

$error

" ?? '

The page you are looking for has expired.

' + ), + 400 ); }