prepareBatchBody method

Future<({List<int> body, Map<String, String> extraHeaders})> prepareBatchBody(
  1. List<Map<String, dynamic>> batch
)

Prepares the batch body bytes for sending.

Override this for custom serialization (e.g., gzip compression). The default implementation JSON-encodes the batch.

Returns a record with body bytes and optional extra headers.

Implementation

Future<({List<int> body, Map<String, String> extraHeaders})> prepareBatchBody(
  List<Map<String, dynamic>> batch,
) async {
  final jsonBody = jsonEncode(batch);
  return (body: utf8.encode(jsonBody), extraHeaders: <String, String>{});
}