From 7654e4cd17599646cfd391720d096ff0820dd9c0 Mon Sep 17 00:00:00 2001 From: Ross Oliver Date: Tue, 3 Nov 2020 16:10:48 +0000 Subject: [PATCH] Disable rate limiting in Staging environments The API uses the staging environment for all production-like environments; we don't want to enforce rate limiting in these environments so that the integration tests can successfully run. --- GetIntoTeachingApi/Startup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GetIntoTeachingApi/Startup.cs b/GetIntoTeachingApi/Startup.cs index e4a0a73a4..489b123aa 100644 --- a/GetIntoTeachingApi/Startup.cs +++ b/GetIntoTeachingApi/Startup.cs @@ -157,11 +157,14 @@ public void ConfigureServices(IServiceCollection services) // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment hostEnv) { - app.UseClientRateLimiting(); - using var serviceScope = app.ApplicationServices.CreateScope(); var env = serviceScope.ServiceProvider.GetService(); + if (!env.IsStaging) + { + app.UseClientRateLimiting(); + } + if (hostEnv.IsDevelopment()) { app.UseDeveloperExceptionPage();