Use array literal [] for empty CORS origins default
Replaces Array.Empty<string>() with the C# array literal [] when defaulting the CORS allowed origins array. This is a syntactic improvement with no change in behavior.
This commit is contained in:
@@ -30,7 +30,7 @@ builder.Services.AddCors(options =>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var origins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get<string[]>() ?? Array.Empty<string>();
|
var origins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get<string[]>() ?? [];
|
||||||
if (origins.Length > 0)
|
if (origins.Length > 0)
|
||||||
{
|
{
|
||||||
policy.WithOrigins(origins)
|
policy.WithOrigins(origins)
|
||||||
|
|||||||
Reference in New Issue
Block a user