Example #1
0
        public Request(string method, Url url, IHttpUtility httpUtility, RequestStream body = null, IDictionary<string, IEnumerable<string>> headers = null, string ip = null)
        {
            method.ArgumentNullOrEmptyCheck("method");
            url.ArgumentNullCheck("url");
            url.Path.ArgumentNullOrEmptyCheck("url.Path");
            url.Scheme.ArgumentNullOrEmptyCheck("url.Scheme");
            httpUtility.ArgumentNullCheck("httpUtility");

            this.httpUtility = httpUtility;

            Items = new Dictionary<string, object>();

            UserHostAddress = ip;

            Url = url;

            Method = method;

            Query = url.Query.AsQueryDictionary(httpUtility);

            Body = body ?? RequestStream.FromStream(new MemoryStream());

            Headers = new RequestHeaders(headers ?? new Dictionary<string, IEnumerable<string>>());

            ParseFormData();
        }