toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};

  if (url != null) {
    json['url'] = url;
  }

  if (method != null) {
    json['method'] = method;
  }

  if (queryString != null) {
    json['query_string'] = queryString;
  }

  if (_data != null) {
    json['data'] = _data;
  }

  if (cookies != null) {
    json['cookies'] = cookies;
  }

  if (headers.isNotEmpty) {
    json['headers'] = headers;
  }

  if (env.isNotEmpty) {
    json['env'] = env;
  }

  if (other.isNotEmpty) {
    json['other'] = other;
  }

  return json;
}