request method
Future<Response>
request(
- String url,
- String method,
- Map<
String, dynamic> data, - Map<
String, String> headers, - Map<
String, dynamic> options,
override
Implementation
@override
Future<Response> request(
String url,
String method,
Map<String, dynamic> data,
Map<String, String> headers,
Map<String, dynamic> options,
) async {
options["url"] = options['origin'] + url;
if (interceptorRequest != null) {
options["headers"] = interceptorRequest?.callback(headers);
} else {
options["headers"] = headers;
}
options["data"] = data;
final res = await call(method, options);
int statusCode = res["statusCode"];
String body = res["data"];
String status = res["status"];
Map<String, dynamic> info = Map<String, dynamic>.from(res["info"]);
Map<String, dynamic> network = Map<String, dynamic>.from(info["net"]);
ResponseInfoDetail infoDetail = ResponseInfoDetail(
timestamp: info["timestamp"],
size: info["size"],
);
ResponseNetworkDetail networkDetail = ResponseNetworkDetail(
type: network["type"],
typeName: network["typeName"],
state: network["state"],
extra: network["extra"],
);
ResponseDetail responseDetail = ResponseDetail(
network: networkDetail,
detail: infoDetail,
);
return Response(statusCode, jsonDecode(body), status, responseDetail);
}