Use HttpMethods helpers
This commit is contained in:
parent
5c8ae98e5b
commit
826e89a2d1
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue