CorsRule.fromJson constructor

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

Implementation

factory CorsRule.fromJson(Map<String, dynamic> json) {
  return CorsRule(
    allowedHeaders: (json['AllowedHeaders'] as List)
        .whereNotNull()
        .map((e) => e as String)
        .toList(),
    allowedOrigins: (json['AllowedOrigins'] as List)
        .whereNotNull()
        .map((e) => e as String)
        .toList(),
    allowedMethods: (json['AllowedMethods'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toMethodName())
        .toList(),
    exposeHeaders: (json['ExposeHeaders'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    maxAgeSeconds: json['MaxAgeSeconds'] as int?,
  );
}