encodeResponse static method
Encode feed response
Implementation
static Uint8List encodeResponse({
required int status,
Map<String, dynamic>? headers,
Uint8List? body,
}) {
final data = <String, dynamic>{
'status': status,
};
if (headers != null && headers.isNotEmpty) data['headers'] = headers;
if (body != null) data['body'] = base64Encode(body);
final json = jsonEncode(data);
return Uint8List.fromList(utf8.encode(json));
}