Changed the abstract class Rule to an interface IRule. Renamed the RuleTermination enum to RuleResult and renamed the values
This commit is contained in:
parent
d2fb2cd776
commit
ead052324c
|
|
@ -4,17 +4,17 @@
|
|||
namespace Microsoft.AspNetCore.Rewrite
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an abstract rule.
|
||||
/// Represents a rule.
|
||||
/// </summary>
|
||||
public abstract class Rule
|
||||
public interface IRule
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies the rule.
|
||||
/// Implementations of ApplyRule should set the value for <see cref="RewriteContext.Result"/>
|
||||
/// (defaults to <see cref="RuleTermination.Continue"/> )
|
||||
/// Implementations of ApplyRule should set the value for <see cref="RewriteContext.Result"/>
|
||||
/// (defaults to RuleResult.ContinueRules)
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
public abstract void ApplyRule(RewriteContext context);
|
||||
void ApplyRule(RewriteContext context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Rewrite.Logging;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
|
||||
{
|
||||
public class ApacheModRewriteRule : Rule
|
||||
public class ApacheModRewriteRule : IRule
|
||||
{
|
||||
public UrlMatch InitialMatch { get; }
|
||||
public IList<Condition> Conditions { get; }
|
||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
|
|||
Actions = urlActions;
|
||||
}
|
||||
|
||||
public override void ApplyRule(RewriteContext context)
|
||||
public virtual void ApplyRule(RewriteContext context)
|
||||
{
|
||||
// 1. Figure out which section of the string to match for the initial rule.
|
||||
var initMatchRes = InitialMatch.Evaluate(context.HttpContext.Request.Path, context);
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
|
|||
{
|
||||
public class FileParser
|
||||
{
|
||||
public IList<Rule> Parse(TextReader input)
|
||||
public IList<IRule> Parse(TextReader input)
|
||||
{
|
||||
string line;
|
||||
var rules = new List<Rule>();
|
||||
var rules = new List<IRule>();
|
||||
var builder = new RuleBuilder();
|
||||
var lineNum = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.ApacheModRewrite
|
|||
else
|
||||
{
|
||||
var last = flags.HasFlag(FlagType.End) || flags.HasFlag(FlagType.Last);
|
||||
var termination = last ? RuleTermination.StopRules : RuleTermination.Continue;
|
||||
var termination = last ? RuleResult.SkipRemainingRules : RuleResult.ContinueRules;
|
||||
_actions.Add(new RewriteAction(termination, pattern, queryStringAppend, queryStringDelete, escapeBackReference));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal
|
||||
{
|
||||
public class DelegateRule : Rule
|
||||
public class DelegateRule : IRule
|
||||
{
|
||||
private readonly Action<RewriteContext> _onApplyRule;
|
||||
|
||||
|
|
@ -13,6 +13,6 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
{
|
||||
_onApplyRule = onApplyRule;
|
||||
}
|
||||
public override void ApplyRule(RewriteContext context) => _onApplyRule(context);
|
||||
public void ApplyRule(RewriteContext context) => _onApplyRule(context);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Rewrite.Logging;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
||||
{
|
||||
public class IISUrlRewriteRule : Rule
|
||||
public class IISUrlRewriteRule : IRule
|
||||
{
|
||||
public string Name { get; }
|
||||
public UrlMatch InitialMatch { get; }
|
||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
Action = action;
|
||||
}
|
||||
|
||||
public override void ApplyRule(RewriteContext context)
|
||||
public virtual void ApplyRule(RewriteContext context)
|
||||
{
|
||||
// Due to the path string always having a leading slash,
|
||||
// remove it from the path before regex comparison
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
private const char CloseBrace = '}';
|
||||
|
||||
/// <summary>
|
||||
/// Creates a pattern, which is a template to create a new test string to
|
||||
/// Creates a pattern, which is a template to create a new test string to
|
||||
/// compare to the condition. Can contain server variables, back references, etc.
|
||||
/// </summary>
|
||||
/// <param name="testString"></param>
|
||||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
context.Mark();
|
||||
// Four main cases:
|
||||
// 1. {NAME} - Server Variable, create lambda to get the part of the context
|
||||
// 2. {R:1} - Rule parameter
|
||||
// 2. {R:1} - IRule parameter
|
||||
// 3. {C:1} - Condition Parameter
|
||||
// 4. {function:xxx} - String function
|
||||
// (unless we support Reload)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
if (xmlRoot != null)
|
||||
{
|
||||
var result = new List<IISUrlRewriteRule>();
|
||||
// TODO Global rules are currently not treated differently than normal rules, fix.
|
||||
// TODO Global rules are currently not treated differently than normal rules, fix.
|
||||
// See: https://github.com/aspnet/BasicMiddleware/issues/59
|
||||
ParseRules(xmlRoot.Descendants(RewriteTags.GlobalRules).FirstOrDefault(), result);
|
||||
ParseRules(xmlRoot.Descendants(RewriteTags.Rules).FirstOrDefault(), result);
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
switch (actionType)
|
||||
{
|
||||
case ActionType.None:
|
||||
_action = new VoidAction(stopProcessing ? RuleTermination.StopRules : RuleTermination.Continue);
|
||||
_action = new VoidAction(stopProcessing ? RuleResult.SkipRemainingRules : RuleResult.ContinueRules);
|
||||
break;
|
||||
case ActionType.Rewrite:
|
||||
_action = new RewriteAction(stopProcessing ? RuleTermination.StopRules : RuleTermination.Continue,
|
||||
_action = new RewriteAction(stopProcessing ? RuleResult.SkipRemainingRules : RuleResult.ContinueRules,
|
||||
url, appendQueryString);
|
||||
break;
|
||||
case ActionType.Redirect:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.Net.Http.Headers;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal
|
||||
{
|
||||
public class RedirectRule : Rule
|
||||
public class RedirectRule : IRule
|
||||
{
|
||||
private readonly TimeSpan _regexTimeout = TimeSpan.FromSeconds(1);
|
||||
public Regex InitialMatch { get; }
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
StatusCode = statusCode;
|
||||
}
|
||||
|
||||
public override void ApplyRule(RewriteContext context)
|
||||
public virtual void ApplyRule(RewriteContext context)
|
||||
{
|
||||
var path = context.HttpContext.Request.Path;
|
||||
var pathBase = context.HttpContext.Request.PathBase;
|
||||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
var response = context.HttpContext.Response;
|
||||
|
||||
response.StatusCode = StatusCode;
|
||||
context.Result = RuleTermination.ResponseComplete;
|
||||
context.Result = RuleResult.EndResponse;
|
||||
|
||||
if (string.IsNullOrEmpty(newPath))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ using Microsoft.AspNetCore.Http;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal
|
||||
{
|
||||
public class RedirectToHttpsRule : Rule
|
||||
public class RedirectToHttpsRule : IRule
|
||||
{
|
||||
public int? SSLPort { get; set; }
|
||||
public int StatusCode { get; set; }
|
||||
|
||||
public override void ApplyRule(RewriteContext context)
|
||||
public virtual void ApplyRule(RewriteContext context)
|
||||
{
|
||||
if (!context.HttpContext.Request.IsHttps)
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
|
||||
var newUrl = new StringBuilder().Append("https://").Append(host).Append(req.PathBase).Append(req.Path).Append(req.QueryString);
|
||||
context.HttpContext.Response.Redirect(newUrl.ToString());
|
||||
context.Result = RuleTermination.ResponseComplete;
|
||||
context.Result = RuleResult.EndResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http.Extensions;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Internal
|
||||
{
|
||||
public class RewriteRule : Rule
|
||||
public class RewriteRule : IRule
|
||||
{
|
||||
private readonly TimeSpan _regexTimeout = TimeSpan.FromSeconds(1);
|
||||
public Regex InitialMatch { get; }
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
StopProcessing = stopProcessing;
|
||||
}
|
||||
|
||||
public override void ApplyRule(RewriteContext context)
|
||||
public virtual void ApplyRule(RewriteContext context)
|
||||
{
|
||||
var path = context.HttpContext.Request.Path;
|
||||
Match initMatchResults;
|
||||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal
|
|||
|
||||
if (StopProcessing)
|
||||
{
|
||||
context.Result = RuleTermination.StopRules;
|
||||
context.Result = RuleResult.SkipRemainingRules;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(result))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
public override void ApplyAction(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)
|
||||
{
|
||||
context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden;
|
||||
context.Result = RuleTermination.ResponseComplete;
|
||||
context.Result = RuleResult.EndResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
public override void ApplyAction(RewriteContext context, MatchResults ruleMatch, MatchResults condMatch)
|
||||
{
|
||||
context.HttpContext.Response.StatusCode = StatusCodes.Status410Gone;
|
||||
context.Result = RuleTermination.ResponseComplete;
|
||||
context.Result = RuleResult.EndResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
response.Headers[HeaderNames.Location] = pathBase + pattern + context.HttpContext.Request.QueryString;
|
||||
}
|
||||
}
|
||||
context.Result = RuleTermination.ResponseComplete;
|
||||
context.Result = RuleResult.EndResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
{
|
||||
public class RewriteAction : UrlAction
|
||||
{
|
||||
public RuleTermination Result { get; }
|
||||
public RuleResult Result { get; }
|
||||
public bool QueryStringAppend { get; }
|
||||
public bool QueryStringDelete { get; }
|
||||
public bool EscapeBackReferences { get; }
|
||||
|
||||
public RewriteAction(
|
||||
RuleTermination result,
|
||||
RuleResult result,
|
||||
Pattern pattern,
|
||||
bool queryStringAppend,
|
||||
bool queryStringDelete,
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
}
|
||||
|
||||
public RewriteAction(
|
||||
RuleTermination result,
|
||||
RuleResult result,
|
||||
Pattern pattern,
|
||||
bool queryStringAppend) :
|
||||
this(result,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.UrlActions
|
|||
{
|
||||
public class VoidAction : UrlAction
|
||||
{
|
||||
public RuleTermination Result { get; }
|
||||
public RuleResult Result { get; }
|
||||
|
||||
public VoidAction(RuleTermination result)
|
||||
public VoidAction(RuleResult result)
|
||||
{
|
||||
Result = result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Rewrite;
|
|||
namespace Microsoft.AspNetCore.Builder
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="RewriteMiddleware"/>
|
||||
/// Extension methods for the <see cref="RewriteMiddleware"/>
|
||||
/// </summary>
|
||||
public static class RewriteBuilderExtensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,17 +24,16 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
public IFileProvider StaticFileProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets and sets the logger
|
||||
/// Gets and sets the logger
|
||||
/// </summary>
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A shared result that is set appropriately by each rule for the next action that
|
||||
/// should be take. See <see cref="RuleTermination"/>
|
||||
/// should be taken. See <see cref="RuleResult"/>
|
||||
/// </summary>
|
||||
public RuleTermination Result { get; set; }
|
||||
public RuleResult Result { get; set; }
|
||||
|
||||
// PERF: share the same string builder per request
|
||||
internal StringBuilder Builder { get; set; } = new StringBuilder(64);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
HttpContext = context,
|
||||
StaticFileProvider = _fileProvider,
|
||||
Logger = _logger,
|
||||
Result = RuleTermination.Continue
|
||||
Result = RuleResult.ContinueRules
|
||||
};
|
||||
|
||||
foreach (var rule in _options.Rules)
|
||||
|
|
@ -77,15 +77,15 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
rule.ApplyRule(rewriteContext);
|
||||
switch (rewriteContext.Result)
|
||||
{
|
||||
case RuleTermination.Continue:
|
||||
case RuleResult.ContinueRules:
|
||||
_logger.RewriteMiddlewareRequestContinueResults();
|
||||
break;
|
||||
case RuleTermination.ResponseComplete:
|
||||
case RuleResult.EndResponse:
|
||||
_logger.RewriteMiddlewareRequestResponseComplete(
|
||||
context.Response.Headers[HeaderNames.Location],
|
||||
context.Response.StatusCode);
|
||||
return TaskCache.CompletedTask;
|
||||
case RuleTermination.StopRules:
|
||||
case RuleResult.SkipRemainingRules:
|
||||
_logger.RewriteMiddlewareRequestStopRules();
|
||||
return _next(context);
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ using Microsoft.AspNetCore.Hosting;
|
|||
namespace Microsoft.AspNetCore.Rewrite
|
||||
{
|
||||
/// <summary>
|
||||
/// Options for the <see cref="RewriteMiddleware"/>
|
||||
/// Options for the <see cref="RewriteMiddleware"/>
|
||||
/// </summary>
|
||||
public class RewriteOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of <see cref="Rule"/> that will be applied in order upon a request.
|
||||
/// A list of <see cref="IRule"/> that will be applied in order upon a request.
|
||||
/// </summary>
|
||||
public IList<Rule> Rules { get; } = new List<Rule>();
|
||||
public IList<IRule> Rules { get; } = new List<IRule>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets and sets the File Provider for file and directory checks. Defaults to <see cref="IHostingEnvironment.WebRootFileProvider"/>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
/// <param name="options">The <see cref="RewriteOptions"/>.</param>
|
||||
/// <param name="rule">A rule to be added to the current rules.</param>
|
||||
/// <returns>The Rewrite options.</returns>
|
||||
public static RewriteOptions Add(this RewriteOptions options, Rule rule)
|
||||
public static RewriteOptions Add(this RewriteOptions options, IRule rule)
|
||||
{
|
||||
options.Rules.Add(rule);
|
||||
return options;
|
||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
/// <returns>The Rewrite options.</returns>
|
||||
public static RewriteOptions AddRewrite(this RewriteOptions options, string regex, string replacement)
|
||||
{
|
||||
return AddRewrite(options, regex, replacement, stopProcessing: false);
|
||||
return AddRewrite(options, regex, replacement, skipRemainingRules: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -53,11 +53,11 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
/// <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 the uri with.</param>
|
||||
/// <param name="stopProcessing">If the regex matches, conditionally stop processing other rules.</param>
|
||||
/// <param name="skipRemainingRules">If the regex matches, conditionally stop processing other rules.</param>
|
||||
/// <returns>The Rewrite options.</returns>
|
||||
public static RewriteOptions AddRewrite(this RewriteOptions options, string regex, string replacement, bool stopProcessing)
|
||||
public static RewriteOptions AddRewrite(this RewriteOptions options, string regex, string replacement, bool skipRemainingRules)
|
||||
{
|
||||
options.Rules.Add(new RewriteRule(regex, replacement, stopProcessing));
|
||||
options.Rules.Add(new RewriteRule(regex, replacement, skipRemainingRules));
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,19 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
/// <summary>
|
||||
/// An enum representing the result of a rule.
|
||||
/// </summary>
|
||||
public enum RuleTermination
|
||||
public enum RuleResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Default value, continue applying rules.
|
||||
/// </summary>
|
||||
Continue,
|
||||
ContinueRules,
|
||||
///<summary>
|
||||
/// Redirect occured, should send back new rewritten url.
|
||||
/// </summary>
|
||||
ResponseComplete,
|
||||
/// The rule ended the request by providing a response.
|
||||
/// </summary>
|
||||
EndResponse,
|
||||
/// <summary>
|
||||
/// Stop applying rules and send context to the next middleware
|
||||
/// </summary>
|
||||
StopRules
|
||||
SkipRemainingRules
|
||||
}
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
)
|
||||
{
|
||||
return new IISUrlRewriteRule(name, new RegexMatch(new Regex("^OFF$"), false), conditions,
|
||||
new RewriteAction(RuleTermination.Continue, new InputParser().ParseInputString(url), queryStringAppend: false));
|
||||
new RewriteAction(RuleResult.ContinueRules, new InputParser().ParseInputString(url), queryStringAppend: false));
|
||||
}
|
||||
|
||||
// TODO make rules comparable?
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
||||
{
|
||||
// TODO add more of these
|
||||
// TODO add more of these
|
||||
public class UrlRewriteApplicationTests
|
||||
{
|
||||
[Fact]
|
||||
|
|
@ -17,10 +17,10 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
{
|
||||
var xml = new StringReader(@"<rewrite>
|
||||
<rules>
|
||||
<rule name=""Test"" stopProcessing=""true"">
|
||||
<rule name=""Test"" stopProcessing=""true"">
|
||||
<match url = ""(.*)""/>
|
||||
<action type = ""None""/>
|
||||
</rule>
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>");
|
||||
var rules = new UrlRewriteFileParser().Parse(xml);
|
||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
Assert.Equal(rules.Count, 1);
|
||||
var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
|
||||
rules.FirstOrDefault().ApplyRule(context);
|
||||
Assert.Equal(context.Result, RuleTermination.StopRules);
|
||||
Assert.Equal(context.Result, RuleResult.SkipRemainingRules);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
<rule name=""Test"">
|
||||
<match url = ""(.*)"" ignoreCase=""false"" />
|
||||
<action type = ""None""/>
|
||||
</rule>
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>");
|
||||
var rules = new UrlRewriteFileParser().Parse(xml);
|
||||
|
|
@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
Assert.Equal(rules.Count, 1);
|
||||
var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
|
||||
rules.FirstOrDefault().ApplyRule(context);
|
||||
Assert.Equal(context.Result, RuleTermination.Continue);
|
||||
Assert.Equal(context.Result, RuleResult.ContinueRules);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlActions
|
|||
action.ApplyAction(context, null, null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(context.Result, RuleTermination.ResponseComplete);
|
||||
Assert.Equal(context.Result, RuleResult.EndResponse);
|
||||
Assert.Equal(context.HttpContext.Response.StatusCode, StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlActions
|
|||
action.ApplyAction(context, null, null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(context.Result, RuleTermination.ResponseComplete);
|
||||
Assert.Equal(context.Result, RuleResult.EndResponse);
|
||||
Assert.Equal(context.HttpContext.Response.StatusCode, StatusCodes.Status410Gone);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue