HttpRequest.fromJson constructor
HttpRequest.fromJson(
- Object? j
Implementation
factory HttpRequest.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return HttpRequest(
method: switch (json['method']) {
null => '',
Object $1 => decodeString($1),
},
uri: switch (json['uri']) {
null => '',
Object $1 => decodeString($1),
},
headers: switch (json['headers']) {
null => [],
List<Object?> $1 => [for (final i in $1) HttpHeader.fromJson(i)],
_ => throw const FormatException('"headers" is not a list'),
},
body: switch (json['body']) {
null => Uint8List(0),
Object $1 => decodeBytes($1),
},
);
}