DVHttpFixture.fromJson constructor

DVHttpFixture.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory DVHttpFixture.fromJson(Map<String, Object?> json) => DVHttpFixture(
      method: '${json['method']}',
      url: Uri.parse('${json['url']}'),
      status: json['status']! as int,
      headers: <String, String>{
        for (final MapEntry<String, Object?> e
            in ((json['headers'] as Map?)?.cast<String, Object?>() ??
                    const <String, Object?>{})
                .entries)
          e.key: '${e.value}',
      },
      body: json['bodyBase64'] != null
          ? base64Decode('${json['bodyBase64']}')
          : utf8.encode('${json['body'] ?? ''}'),
    );