BloomResponse.html constructor
Helper factory constructor for HTML responses.
Sets Content-Type: text/html; charset=utf-8 and encodes html as UTF-8 bytes.
Example
return BloomResponse.html('<h1>Hello Bloom</h1>');
Implementation
factory BloomResponse.html(
String html, {
int statusCode = 200,
Map<String, String>? headers,
}) {
final finalHeaders = <String, String>{
'content-type': 'text/html; charset=utf-8',
...?headers,
};
return BloomResponse(
statusCode: statusCode,
headers: finalHeaders,
body: Uint8List.fromList(utf8.encode(html)),
);
}