Remove rewrite rule API with default assumptions about skip remaining rules (#105)
This commit is contained in:
parent
2a386b7b76
commit
3e119a87be
|
|
@ -15,7 +15,7 @@ namespace RewriteSample
|
|||
{
|
||||
var options = new RewriteOptions()
|
||||
.AddRedirect("(.*)/$", "$1")
|
||||
.AddRewrite(@"app/(\d+)", "app?id=$1")
|
||||
.AddRewrite(@"app/(\d+)", "app?id=$1", skipRemainingRules: false)
|
||||
.AddRedirectToHttps(302, 5001)
|
||||
.AddIISUrlRewrite(env.ContentRootFileProvider, "UrlRewrite.xml")
|
||||
.AddApacheModRewrite(env.ContentRootFileProvider, "Rewrite.txt");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
|
|
@ -36,19 +36,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rewrites the path if the regex matches the HttpContext's PathString
|
||||
/// </summary>
|
||||
/// <param name="options">The <see cref="RewriteOptions"/>.</param>
|
||||
/// <param name="regex">The regex string to compare with.</param>
|
||||
/// <param name="replacement">If the regex matches, what to replace HttpContext with.</param>
|
||||
/// <returns>The Rewrite options.</returns>
|
||||
public static RewriteOptions AddRewrite(this RewriteOptions options, string regex, string replacement)
|
||||
{
|
||||
return AddRewrite(options, regex, replacement, skipRemainingRules: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rewrites the path if the regex matches the HttpContext's PathString
|
||||
/// Adds a rule that rewrites the path if the regex matches the HttpContext's PathString.
|
||||
/// </summary>
|
||||
/// <param name="options">The <see cref="RewriteOptions"/>.</param>
|
||||
/// <param name="regex">The regex string to compare with.</param>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.CodeRules
|
|||
[Fact]
|
||||
public async Task CheckRewritePath()
|
||||
{
|
||||
var options = new RewriteOptions().AddRewrite("(.*)", "http://example.com/$1");
|
||||
var options = new RewriteOptions().AddRewrite("(.*)", "http://example.com/$1", skipRemainingRules: false);
|
||||
var builder = new WebHostBuilder()
|
||||
.Configure(app =>
|
||||
{
|
||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.CodeRules
|
|||
[Fact]
|
||||
public async Task CheckIfEmptyStringRewriteCorrectly()
|
||||
{
|
||||
var options = new RewriteOptions().AddRewrite("(.*)", "$1");
|
||||
var options = new RewriteOptions().AddRewrite("(.*)", "$1", skipRemainingRules: false);
|
||||
var builder = new WebHostBuilder()
|
||||
.Configure(app =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue