ServerResponse class

Framework-agnostic HTTP response generated by MetaMantle SSR.

Constructors

ServerResponse({required int statusCode, Map<String, String>? headers, String body = '', List<int>? bodyBytes})
ServerResponse.gone({String message = 'This resource has been permanently removed.', String? html})
Creates a 410 Gone response for permanently removed resources.
factory
ServerResponse.notFound({String message = 'Page Not Found', String? html})
Creates a 404 Not Found response.
factory
ServerResponse.notModified({String? etag, DateTime? lastModified, String? cacheControl, Map<String, String>? headers})
Creates a 304 Not Modified conditional response.
factory
ServerResponse.okHtml(String html, {Map<String, String>? headers, String? etag, DateTime? lastModified, String? cacheControl})
Creates a successful 200 OK HTML response.
factory
ServerResponse.redirect(String location, {int statusCode = 301, Map<String, String>? headers})
Creates a redirect response (301, 302, 307, 308).
factory
ServerResponse.serverError({String message = 'An unexpected error occurred.', String? html})
Creates a 500 Internal Server Error response.
factory

Properties

body → String
final
bodyBytes → List<int>
final
hashCode → int
The hash code for this object.
no setterinherited
headers → Map<String, String>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statusCode → int
final

Methods

Retrieves an outgoing response header by name (case-insensitive).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited