ServiceStack.HttpRequestExtensions.GetHttpMethodOverride C# (CSharp) Method

GetHttpMethodOverride() public static method

public static GetHttpMethodOverride ( this httpReq ) : string
httpReq this
return string
        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;
        }