headUri<T> method

Future<BaseModel> headUri<T>(
  1. Uri uri, {
  2. Object? data,
  3. dynamic tag,
  4. bool? loading,
  5. bool dataToJson = true,
  6. Options? options,
  7. CancelToken? cancelToken,
})

Implementation

Future<BaseModel> headUri<T>(
  Uri uri, {
  Object? data,
  dynamic tag,
  bool? loading,
  bool dataToJson = true,
  Options? options,
  CancelToken? cancelToken,
}) async {
  assert(_singleton != null, '请先调用 initialize');
  if (hasNetWork) return notNetWorkModel;
  _addLoading(loading);
  data = baseDioOptions.extraUriData?.call(uri, data) ?? data;
  uri = baseDioOptions.extraUri?.call(uri) ?? uri;
  final res = await dio.headUri<T>(uri,
      options: _mergeOptions(options, uri.path),
      cancelToken: cancelToken,
      data: dataToJson ? jsonEncode(data) : data);
  return _response(res, tag);
}