onRequest method

  1. @override
void onRequest(
  1. RequestOptions options,
  2. RequestInterceptorHandler handler
)

请求体数据采集

Implementation

@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
  var reqOpt = ReqOptions();
  reqOpt.id = options.hashCode;
  reqOpt.url = options.uri.toString();
  reqOpt.method = options.method;
  reqOpt.contentType = options.contentType.toString();
  reqOpt.requestTime = DateTime.now();
  reqOpt.params = options.queryParameters;
  reqOpt.data = options.data;
  reqOpt.headers = options.headers;
  logManage?.onRequest(reqOpt);
  return handler.next(options);
}