defaultBody property

String defaultBody

Generate default HTML for this HTTP error without fail contains information about status and message additional, can contains information about exception and stackTrace

Implementation

String get defaultBody {
  var res = '''<html lang="en">
  <head>
    <title>$_status $_message</title>
  </head>
  <body>
    <h1>$_status $_message</h1>''';
  if (_exception != null) {
    res += '<h2>$_exception</h2>';
  }
  if (_stackTrace != null) {
    res += '''<h3>StackTrace</h3>
    <p>
    ''';
    final stack = _stackTrace.toString().split('\n');
    for (var index = 0; index < stack.length; index++) {
      final str = stack[index];
      res += '$str<br/>';
    }

    res += '</p>';
  }

  res += '''
  </body>
  </html>''';

  return res;
}