ServiceStack.HttpRequestExtensions.GetQueryStringContentType C# (CSharp) Метод

GetQueryStringContentType() публичный статический Метод

public static GetQueryStringContentType ( this httpReq ) : string
httpReq this
Результат string
        public static string GetQueryStringContentType(this IRequest httpReq)
        {
            var callback = httpReq.QueryString[Keywords.Callback];
            if (!IsNullOrEmpty(callback)) return MimeTypes.Json;

            var format = httpReq.QueryString[Keywords.Format];
            if (format == null)
            {
                const int formatMaxLength = 4;
                var pi = httpReq.PathInfo;
                if (pi == null || pi.Length <= formatMaxLength) return null;
                if (pi[0] == '/') pi = pi.Substring(1);
                format = pi.LeftPart('/');
                if (format.Length > formatMaxLength) return null;
            }

            format = format.LeftPart('.').ToLower();
            if (format.Contains("json")) return MimeTypes.Json;
            if (format.Contains("xml")) return MimeTypes.Xml;
            if (format.Contains("jsv")) return MimeTypes.Jsv;

            string contentType;
            HostContext.ContentTypes.ContentTypeFormats.TryGetValue(format, out contentType);

            return contentType;
        }