public static string GetHttpMethodOverride(this IRequest httpReq)
{
var httpMethod = httpReq.Verb;
if (httpMethod != HttpMethods.Post)
return httpMethod;
var overrideHttpMethod =
httpReq.Headers[HttpHeaders.XHttpMethodOverride].ToNullIfEmpty()
?? httpReq.FormData[HttpHeaders.XHttpMethodOverride].ToNullIfEmpty()
?? httpReq.QueryString[HttpHeaders.XHttpMethodOverride].ToNullIfEmpty();
if (overrideHttpMethod != null)
{
if (overrideHttpMethod != HttpMethods.Get && overrideHttpMethod != HttpMethods.Post)
httpMethod = overrideHttpMethod;
}
return httpMethod;
}