decodeRequest function
Implementation
Request decodeRequest(Object? json, [String field = 'request']) {
final map = _object(json, field);
return Request(
decodeOrigin(map['origin'], '$field.origin'),
method: map.containsKey('method')
? decodeMethod(map['method'], '$field.method')
: Method.get,
path: map.containsKey('path')
? decodeWebPath(map['path'], '$field.path')
: WebPath.root,
signIn: map['signIn'] == null
? null
: decodeSignIn(map['signIn'], '$field.signIn'),
headers: map.containsKey('headers')
? decodeHeaders(map['headers'], '$field.headers')
: const {},
body: switch (map['body']) {
null => null,
final String body => body,
_ => throw FormatException('$field.body: not a string'),
},
);
}