Add support for REQUEST_METHOD server variable (#294)
This commit is contained in:
parent
aa0395847f
commit
f2676babd3
|
|
@ -60,6 +60,8 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
|
|||
return new RemotePortSegment();
|
||||
case "REQUEST_FILENAME":
|
||||
return new RequestFileNameSegment();
|
||||
case "REQUEST_METHOD":
|
||||
return new RequestMethodSegment();
|
||||
case "REQUEST_URI":
|
||||
return new UrlSegment(uriMatchPart);
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
[InlineData("REQUEST_FILENAME", "/foo", UriMatchPart.Path)]
|
||||
[InlineData("REQUEST_URI", "/foo", UriMatchPart.Path)]
|
||||
[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)
|
||||
{
|
||||
// Arrange and Act
|
||||
|
|
@ -40,6 +41,7 @@ namespace Microsoft.AspNetCore.Rewrite.Tests.UrlRewrite
|
|||
private RewriteContext CreateTestHttpContext()
|
||||
{
|
||||
var context = new DefaultHttpContext();
|
||||
context.Request.Method = HttpMethods.Get;
|
||||
context.Request.Scheme = "http";
|
||||
context.Request.Host = new HostString("example.com");
|
||||
context.Request.Path = PathString.FromUriComponent("/foo");
|
||||
|
|
|
|||
Loading…
Reference in New Issue