HTTPRoute.fromJson constructor

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

Creates a HTTPRoute from JSON data.

Implementation

HTTPRoute.fromJson(Map<String, dynamic> json)
    : this(
        name: json['name'],
        match: json['match'] != null
            ? (json['match'] as Iterable)
                .cast<Map<String, dynamic>>()
                .map((e) => HTTPMatchRequest.fromJson(e))
                .toList()
            : null,
        route: json['route'] != null
            ? (json['route'] as Iterable)
                .cast<Map<String, dynamic>>()
                .map((e) => HTTPRouteDestination.fromJson(e))
                .toList()
            : null,
        redirect: json['redirect'] != null
            ? HTTPRedirect.fromJson(json['redirect'])
            : null,
        delegate: json['delegate'] != null
            ? Delegate.fromJson(json['delegate'])
            : null,
        rewrite: json['rewrite'] != null
            ? HTTPRewrite.fromJson(json['rewrite'])
            : null,
        timeout: parseDuration(json['timeout']),
        retries: json['retries'] != null
            ? HTTPRetry.fromJson(json['retries'])
            : null,
        fault: json['fault'] != null
            ? HTTPFaultInjection.fromJson(json['fault'])
            : null,
        mirror: json['mirror'] != null
            ? Destination.fromJson(json['mirror'])
            : null,
        mirrorPercentage: json['mirrorPercentage'] != null
            ? Percent.fromJson(json['mirrorPercentage'])
            : null,
        corsPolicy: json['corsPolicy'] != null
            ? CorsPolicy.fromJson(json['corsPolicy'])
            : null,
        headers: json['headers'] != null
            ? Headers.fromJson(json['headers'])
            : null,
        mirrorPercent: json['mirrorPercent'],
      );