saveRequest method

  1. @override
Future<String> saveRequest(
  1. RequestOptions options
)
override

Implementation

@override
Future<String> saveRequest(RequestOptions options) {
  final httpRequest = HttpRequest(
    baseUrl: options.baseUrl,
    path: options.uri.path,
    params: _jsonUtil.encodeRawJson(options.uri.parameters),
    method: options.method,
    server: options.uri.host,
    secure: options.uri.scheme == 'https',
    client: "Dio",
    requestHeader: _jsonUtil.encodeRawJson(options.headers),
    requestBody: _jsonUtil.encodeRawJson(options.data),
    createdAt: DateTime.now().millisecondsSinceEpoch,
    requestSize: _byteUtil.stringToBytes(options.data.toString()),
    requestHashCode: options.hashCode,
  );
  _requests.addAll([httpRequest]);
  _activities.add(HttpActivity(request: httpRequest));
  _dataSubject.add(_activities);
  return Future.value('success');
}