Merge release/2.1 - Add support for REQUEST_METHOD server variable
This commit is contained in:
parent
dd03838728
commit
b85d69c882
|
|
@ -60,6 +60,8 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
||||||
return new RemotePortSegment();
|
return new RemotePortSegment();
|
||||||
case "REQUEST_FILENAME":
|
case "REQUEST_FILENAME":
|
||||||
return new RequestFileNameSegment();
|
return new RequestFileNameSegment();
|
||||||
|
case "REQUEST_METHOD":
|
||||||
|
return new RequestMethodSegment();
|
||||||
case "REQUEST_URI":
|
case "REQUEST_URI":
|
||||||
return new UrlSegment(uriMatchPart);
|
return new UrlSegment(uriMatchPart);
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
||||||
[InlineData("REQUEST_FILENAME", "/foo", UriMatchPart.Path)]
|
[InlineData("REQUEST_FILENAME", "/foo", UriMatchPart.Path)]
|
||||||
[InlineData("REQUEST_URI", "/foo", UriMatchPart.Path)]
|
[InlineData("REQUEST_URI", "/foo", UriMatchPart.Path)]
|
||||||
[InlineData("REQUEST_URI", "http://example.com/foo?bar=1", UriMatchPart.Full)]
|
[InlineData("REQUEST_URI", "http://example.com/foo?bar=1", UriMatchPart.Full)]
|
||||||
|
[InlineData("REQUEST_METHOD", "GET", UriMatchPart.Full)]
|
||||||
public void CheckServerVariableParsingAndApplication(string variable, string expected, UriMatchPart uriMatchPart)
|
public void CheckServerVariableParsingAndApplication(string variable, string expected, UriMatchPart uriMatchPart)
|
||||||
{
|
{
|
||||||
// Arrange and Act
|
// Arrange and Act
|
||||||
|
|
@ -40,6 +41,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
||||||
private RewriteContext CreateTestHttpContext()
|
private RewriteContext CreateTestHttpContext()
|
||||||
{
|
{
|
||||||
var context = new DefaultHttpContext();
|
var context = new DefaultHttpContext();
|
||||||
|
context.Request.Method = HttpMethods.Get;
|
||||||
context.Request.Scheme = "http";
|
context.Request.Scheme = "http";
|
||||||
context.Request.Host = new HostString("example.com");
|
context.Request.Host = new HostString("example.com");
|
||||||
context.Request.Path = PathString.FromUriComponent("/foo");
|
context.Request.Path = PathString.FromUriComponent("/foo");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue