Esempio n. 1
0
        public static RequestLine Create(string method, string pathInfo = null, string queryString = null)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            if (pathInfo == null)
            {
                pathInfo = string.Empty;
            }

            if (queryString == null)
            {
                queryString = string.Empty;
            }

            if (pathInfo != string.Empty && !pathInfo.StartsWith("/"))
            {
                pathInfo = "/" + pathInfo;
            }

            if (pathInfo.EndsWith("/"))
            {
                pathInfo = pathInfo.Remove(pathInfo.Length - 1);
            }

            var requestLine = new RequestLine
            {
                Method      = method,
                PathInfo    = pathInfo,
                QueryString = queryString
            };


            return(requestLine);
        }
Esempio n. 2
0
        public static RequestLine Create(string method, string pathInfo = null, string queryString = null)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            if (pathInfo == null)
            {
                pathInfo = string.Empty;
            }

            if (queryString == null)
            {
                queryString = string.Empty;
            }

            if (pathInfo != string.Empty && !pathInfo.StartsWith("/"))
            {
                pathInfo = "/" + pathInfo;
            }

            if (pathInfo.EndsWith("/"))
            {
                pathInfo = pathInfo.Remove(pathInfo.Length - 1);
            }

            var requestLine = new RequestLine
                                  {
                                      Method = method,
                                      PathInfo = pathInfo,
                                      QueryString = queryString
                                  };

            return requestLine;
        }