ServerResponse.notFound constructor
Creates a 404 Not Found response.
Implementation
factory ServerResponse.notFound({
String message = 'Page Not Found',
String? html,
}) {
final bodyHtml =
html ??
'<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>404 — Page Not Found</h1><p>$message</p></body></html>';
return ServerResponse(
statusCode: 404,
headers: {
'Content-Type': 'text/html; charset=utf-8',
'Cache-Control': 'no-cache, no-store, must-revalidate',
},
body: bodyHtml,
);
}