CloudflareResponse.json constructor

CloudflareResponse.json(
  1. Object? value, {
  2. int status = 200,
  3. Map<String, String> headers = const <String, String>{},
})

Provides the declared Cloudflare API member.

Implementation

factory CloudflareResponse.json(
  Object? value, {
  int status = 200,
  Map<String, String> headers = const <String, String>{},
}) {
  return CloudflareResponse(
    body: jsonEncode(value),
    status: status,
    headers: <String, String>{
      'content-type': 'application/json; charset=utf-8',
      ...headers,
    },
  );
}