HTTPGetAction.fromJson constructor

HTTPGetAction.fromJson(
  1. Map<String, dynamic> json
)

Creates a HTTPGetAction from JSON data.

Implementation

factory HTTPGetAction.fromJson(Map<String, dynamic> json) {
  final tempHostJson = json['host'];
  final tempHttpHeadersJson = json['httpHeaders'];
  final tempPathJson = json['path'];
  final tempPortJson = json['port'];
  final tempSchemeJson = json['scheme'];

  final String? tempHost = tempHostJson;

  final List<HTTPHeader>? tempHttpHeaders = tempHttpHeadersJson != null
      ? List<dynamic>.from(tempHttpHeadersJson)
          .map(
            (e) => HTTPHeader.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final String? tempPath = tempPathJson;
  final IntOrString tempPort = IntOrString(tempPortJson);
  final String? tempScheme = tempSchemeJson;

  return HTTPGetAction(
    host: tempHost,
    httpHeaders: tempHttpHeaders,
    path: tempPath,
    port: tempPort,
    scheme: tempScheme,
  );
}