Use HttpMethods helpers

This commit is contained in:
Kristian Hellang 2017-10-03 16:56:59 +02:00
parent 5c8ae98e5b
commit 826e89a2d1
3 changed files with 4 additions and 15 deletions

View File

@ -18,20 +18,9 @@ namespace Microsoft.AspNetCore.StaticFiles
return hostingEnv.WebRootFileProvider;
}
internal static bool IsGetOrHeadMethod(string method)
{
return IsGetMethod(method) || IsHeadMethod(method);
}
internal static bool IsGetMethod(string method)
{
return string.Equals("GET", method, StringComparison.OrdinalIgnoreCase);
}
internal static bool IsHeadMethod(string method)
{
return string.Equals("HEAD", method, StringComparison.OrdinalIgnoreCase);
return HttpMethods.IsGet(method) || HttpMethods.IsHead(method);
}
internal static bool PathEndsInSlash(PathString path)

View File

@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.StaticFiles
context.Response.ContentType = TextHtmlUtf8;
if (Helpers.IsHeadMethod(context.Request.Method))
if (HttpMethods.IsHead(context.Request.Method))
{
// HEAD, no response body
return Constants.CompletedTask;

View File

@ -111,8 +111,8 @@ namespace Microsoft.AspNetCore.StaticFiles
public bool ValidateMethod()
{
_method = _request.Method;
_isGet = Helpers.IsGetMethod(_method);
_isHead = Helpers.IsHeadMethod(_method);
_isGet = HttpMethods.IsGet(_method);
_isHead = HttpMethods.IsHead(_method);
return _isGet || _isHead;
}