ServerResponse.gone constructor

ServerResponse.gone({
  1. String message = 'This resource has been permanently removed.',
  2. String? html,
})

Creates a 410 Gone response for permanently removed resources.

Implementation

factory ServerResponse.gone({
  String message = 'This resource has been permanently removed.',
  String? html,
}) {
  final bodyHtml =
      html ??
      '<!DOCTYPE html><html><head><title>410 Gone</title></head><body><h1>410 — Resource Gone</h1><p>$message</p></body></html>';
  return ServerResponse(
    statusCode: 410,
    headers: {
      'Content-Type': 'text/html; charset=utf-8',
      'Cache-Control': 'public, max-age=86400',
    },
    body: bodyHtml,
  );
}