HttpRouteAction.fromJson constructor

HttpRouteAction.fromJson(
  1. Object? j
)

Implementation

factory HttpRouteAction.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HttpRouteAction(
    cachePolicy: switch (json['cachePolicy']) {
      null => null,
      Object $1 => CachePolicy.fromJson($1),
    },
    corsPolicy: switch (json['corsPolicy']) {
      null => null,
      Object $1 => CorsPolicy.fromJson($1),
    },
    faultInjectionPolicy: switch (json['faultInjectionPolicy']) {
      null => null,
      Object $1 => HttpFaultInjection.fromJson($1),
    },
    maxStreamDuration: switch (json['maxStreamDuration']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    requestMirrorPolicy: switch (json['requestMirrorPolicy']) {
      null => null,
      Object $1 => RequestMirrorPolicy.fromJson($1),
    },
    retryPolicy: switch (json['retryPolicy']) {
      null => null,
      Object $1 => HttpRetryPolicy.fromJson($1),
    },
    timeout: switch (json['timeout']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    urlRewrite: switch (json['urlRewrite']) {
      null => null,
      Object $1 => UrlRewrite.fromJson($1),
    },
    weightedBackendServices: switch (json['weightedBackendServices']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) WeightedBackendService.fromJson(i),
      ],
      _ => throw const FormatException(
        '"weightedBackendServices" is not a list',
      ),
    },
  );
}