Skip to content

Commit

Permalink
Refactor CORS policy name to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Feb 15, 2024
1 parent 543b139 commit f7458b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions AzureSearchEmulator/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace AzureSearchEmulator;

public class Startup(IConfiguration configuration)
{
private const string CorsDefaultPolicyName = "AllowAllOrigins";

public IConfiguration Configuration { get; } = configuration;

// This method gets called by the runtime. Use this method to add services to the container.
Expand All @@ -27,7 +29,7 @@ public void ConfigureServices(IServiceCollection services)

services.AddCors(options =>
{
options.AddPolicy("AllowAllOrigins",
options.AddPolicy(CorsDefaultPolicyName,
builder =>
{
builder
Expand Down Expand Up @@ -74,7 +76,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseDeveloperExceptionPage();
}

app.UseCors("AllowAllOrigins");
app.UseCors(CorsDefaultPolicyName);
app.UseODataRouteDebug();
app.UseODataQueryRequest();
app.UseODataBatching();
Expand Down

0 comments on commit f7458b4

Please sign in to comment.