Throw for trackAllCaptures
This commit is contained in:
parent
fa8ec4131f
commit
5d6fcb07da
|
|
@ -110,6 +110,10 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
||||||
|
|
||||||
var grouping = ParseEnum(conditions, RewriteTags.LogicalGrouping, LogicalGrouping.MatchAll);
|
var grouping = ParseEnum(conditions, RewriteTags.LogicalGrouping, LogicalGrouping.MatchAll);
|
||||||
var trackAllCaptures = ParseBool(conditions, RewriteTags.TrackAllCaptures, defaultValue: false);
|
var trackAllCaptures = ParseBool(conditions, RewriteTags.TrackAllCaptures, defaultValue: false);
|
||||||
|
if (trackAllCaptures)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Support for trackAllCaptures has not been implemented yet");
|
||||||
|
}
|
||||||
builder.AddUrlConditions(grouping, trackAllCaptures);
|
builder.AddUrlConditions(grouping, trackAllCaptures);
|
||||||
|
|
||||||
foreach (var cond in conditions.Elements(RewriteTags.Add))
|
foreach (var cond in conditions.Elements(RewriteTags.Add))
|
||||||
|
|
|
||||||
|
|
@ -264,5 +264,26 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
||||||
var ex = Assert.Throws<FormatException>(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
|
var ex = Assert.Throws<FormatException>(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
|
||||||
Assert.Equal(expected, ex.Message);
|
Assert.Equal(expected, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(
|
||||||
|
@"<rewrite>
|
||||||
|
<rules>
|
||||||
|
<rule name=""Remove trailing slash"">
|
||||||
|
<match url = ""(.*)/$""/>
|
||||||
|
<conditions trackAllCaptures=""true"">
|
||||||
|
<add input=""{REQUEST_FILENAME}""/>
|
||||||
|
</conditions>
|
||||||
|
<action type=""Redirect"" url =""{R:1}"" />
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</rewrite>",
|
||||||
|
"Support for trackAllCaptures has not been implemented yet")]
|
||||||
|
public void ThrowNotSupportedExceptionWithCorrectMessage(string input, string expected)
|
||||||
|
{
|
||||||
|
// Arrange, Act, Assert
|
||||||
|
var ex = Assert.Throws<NotSupportedException>(() => new UrlRewriteFileParser().Parse(new StringReader(input)));
|
||||||
|
Assert.Equal(expected, ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue