ServiceStack.HttpRequestExtensions.GetPathUrl C# (CSharp) Method

GetPathUrl() public static method

public static GetPathUrl ( this httpReq ) : string
httpReq this
return string
        public static string GetPathUrl(this IRequest httpReq)
        {
            var resolvedPathInfo = httpReq.PathInfo.TrimEnd('/');

            int pos;

            if (resolvedPathInfo == Empty)
            {
                pos = httpReq.AbsoluteUri.IndexOf('?');
                if (pos == -1)
                    pos = httpReq.AbsoluteUri.Length;
            }
            else
            {
                pos = httpReq.AbsoluteUri.IndexOf(resolvedPathInfo, StringComparison.OrdinalIgnoreCase);
            }

            if (pos == -1)
                throw new ArgumentException($"PathInfo '{resolvedPathInfo}' is not in Url '{httpReq.RawUrl}'");

            return httpReq.AbsoluteUri.Substring(0, pos + resolvedPathInfo.Length);
        }