mapAsync method
Asynchronously maps a source object to the target type
source - The source object to map
Implementation
@override
Future<PHttpRequest> mapAsync(RequestContext source) async {
final data = await _resolveData(source);
return PHttpRequest.withData(
uri: source.request.uri,
headers: source.request.headers,
queryParameters: source.request.uri.queryParameters,
requestId: source.request.headers['x-request-id'] ?? Uuid().v4(),
data: switch (data) {
FormData() => mapper.map(data),
_ => data,
},
method: mapper.map(source.request.method),
);
}