feat: add text/plain content type for non-html error resp

This commit is contained in:
Victor Westerlund 2024-09-20 13:28:08 +02:00
parent 84e27f66ea
commit ea2ab2082e

View file

@ -46,9 +46,11 @@
// Return HTML page if supported by client // Return HTML page if supported by client
if ($_SERVER["HTTP_ACCEPT"] === "*/*" || strpos($_SERVER["HTTP_ACCEPT"] ?? "", "text/html") !== false) { 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)); die(sprintf(file_get_contents(__DIR__ . "/error.html"), $error->value, $error->name));
} }
header("Content-Type: text/plain", true);
die($error->name); die($error->name);
} }