toJson method

Map<String, Object> toJson()

Converts a HTTPGetAction instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempHost = host;
  final tempHttpHeaders = httpHeaders;
  final tempPath = path;
  final tempPort = port;
  final tempScheme = scheme;

  if (tempHost != null) {
    jsonData['host'] = tempHost;
  }

  if (tempHttpHeaders != null) {
    jsonData['httpHeaders'] =
        tempHttpHeaders.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempPath != null) {
    jsonData['path'] = tempPath;
  }

  jsonData['port'] = tempPort;

  if (tempScheme != null) {
    jsonData['scheme'] = tempScheme;
  }

  return jsonData;
}