How do I test an https redirect in ASP.NET Core?
问题 Recently, I came up with unit tests for checking some redirect rules of my ASP.NET Core 2.1 application: [Fact(DisplayName = "lowercase path")] public async Task LowercaseRedirect() { var result = await this.Client.GetAsync("/BLOG/"); Assert.EndsWith("/blog/", result.RequestMessage.RequestUri.PathAndQuery, StringComparison.InvariantCulture); } [Fact(DisplayName = "add missing slash")] public async Task SlashRedirect() { var result = await this.Client.GetAsync("/blog"); Assert.EndsWith("/blog/