title: The HTTP client does not redirect in the integration tests
body: <p>I have setup an integration test:</p>
  
  <pre><code>public class IntegrationTests
  {
      private readonly TestServer _server;
      private readonly HttpClient _client;
  
      public IntegrationTests()
      {
          _server = new TestServer(WebHost.CreateDefaultBuilder().UseEnvironment("Development").UseStartup&lt;Startup&gt;())
          {
              PreserveExecutionContext = true,
          };
          _client = _server.CreateClient();
      }
  
      [Test]
      public async Task RunARoute()
      {
          var response = await _client.GetAsync("/foo");
  
          Check.That(response.IsSuccessStatusCode).IsTrue();
      }
  }
  </code></pre>
  
  <p>The startup:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddControllersWithViews()
          .AddApplicationPart(typeof(HomeController).Assembly)
          .AddControllersAsServices()
          .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
  
      services
          .ConfigureAll(Configuration) // Add the configuration sections
          .AddAllServices() // DI
          // Other:
          .AddAutoMapperProfiles(AutoMapperConfiguration.LoadConfig)
          .AddCacheHelper(e =&gt; {})
          .AddSession(opt =&gt; opt.Cookie.IsEssential = true);
  }
  
  public void Configure(IApplicationBuilder app)
  {
      app.UseHttpsRedirection()
          .UseStaticFiles()
          .UseRouting()
          .UseCookiePolicy()
          .UseSession()
          .UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllerRoute(
                  "default",
                  "{controller=Home}/{action=Index}/{id?}");
          });
  }
  </code></pre>
  
  <p>In the test method, the route that I call redirects to another route: <code>return RedirectToAction(nameof(Bar))</code>. I'd like to test that the page is correctly returned by the <code>Bar</code> method, but unfortunately, the <code>HttpClient</code> does not redirect the call: my test fails with a code <code>302</code>.</p>
  
  <p>I've read on the Internet that this issue usually occurs when there is an attempt of a redirection from an HTTPS route to an HTTP one, but AFAIK, that's not the case here, since the test server creates a client with the base URL <code>http://localhost/</code>, and the redirection URL is relative (so no protocol specified).</p>
  
  <p>How can I ensure that the client redirects the calls?</p>