HttpRouteRule.fromJson constructor

HttpRouteRule.fromJson(
  1. Object? j
)

Implementation

factory HttpRouteRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HttpRouteRule(
    customErrorResponsePolicy: switch (json['customErrorResponsePolicy']) {
      null => null,
      Object $1 => CustomErrorResponsePolicy.fromJson($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    headerAction: switch (json['headerAction']) {
      null => null,
      Object $1 => HttpHeaderAction.fromJson($1),
    },
    matchRules: switch (json['matchRules']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) HttpRouteRuleMatch.fromJson(i),
      ],
      _ => throw const FormatException('"matchRules" is not a list'),
    },
    priority: switch (json['priority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    routeAction: switch (json['routeAction']) {
      null => null,
      Object $1 => HttpRouteAction.fromJson($1),
    },
    service: switch (json['service']) {
      null => null,
      Object $1 => decodeString($1),
    },
    urlRedirect: switch (json['urlRedirect']) {
      null => null,
      Object $1 => HttpRedirectAction.fromJson($1),
    },
  );
}