From ea2ab2082e87d25c22369c0a2e38f0d7d8b15da7 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Fri, 20 Sep 2024 13:28:08 +0200 Subject: [PATCH] feat: add text/plain content type for non-html error resp --- src/Router.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Router.php b/src/Router.php index 61f8737..b69966f 100644 --- a/src/Router.php +++ b/src/Router.php @@ -46,9 +46,11 @@ // Return HTML page if supported by client if ($_SERVER["HTTP_ACCEPT"] === "*/*" || strpos($_SERVER["HTTP_ACCEPT"] ?? "", "text/html") !== false) { + header("Content-Type: text/html", true); die(sprintf(file_get_contents(__DIR__ . "/error.html"), $error->value, $error->name)); } + header("Content-Type: text/plain", true); die($error->name); }