Пример #1
0
        public OwinRequestData(RouteData routeData, OwinRequestBody body)
        {
            AddValues(new RouteDataValues(routeData));

            AddValues(Querystring, new DictionaryKeyValues(body.Querystring()));
            AddValues(FormPost, new DictionaryKeyValues(body.FormData ?? new Dictionary <string, string>()));

            AddValues(RequestDataSource.Header.ToString(), new DictionaryKeyValues(body.Headers()));
        }
Пример #2
0
        public OwinRequestData(RouteData routeData, OwinRequestBody body)
        {
            AddValues(new RouteDataValues(routeData));

            AddValues("OwinQuerystring", new DictionaryKeyValues(body.Querystring()));
            AddValues("OwinFormPost", new DictionaryKeyValues(body.FormData ?? new Dictionary<string, string>()));

            AddValues(RequestDataSource.Header.ToString(), new DictionaryKeyValues(body.Headers()));
        }
Пример #3
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            Func <string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return(found);
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);
            AddLocator(RequestDataSource.Request.ToString(), key => findRequestValue(key, body), () => valuesForRequest(body).Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary <string, string>());
            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
Пример #4
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            Func<string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return found;
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);
            AddLocator(RequestDataSource.Request.ToString(), key => findRequestValue(key, body), () => valuesForRequest(body).Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary<string, string>());
            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
Пример #5
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            // TODO -- this is duplication w/ AspNetAggregateDictionary.  DRY it baby!
            Func<string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return found;
            };

            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary<string, string>());

            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
Пример #6
0
        public OwinAggregateDictionary(RouteData routeData, OwinRequestBody body)
        {
            // TODO -- this is duplication w/ AspNetAggregateDictionary.  DRY it baby!
            Func <string, object> locator = key =>
            {
                object found;
                routeData.Values.TryGetValue(key, out found);
                return(found);
            };


            AddLocator(RequestDataSource.Route.ToString(), locator, () => routeData.Values.Keys);

            addDictionaryLocator("Query string", body.Querystring());
            addDictionaryLocator("Form Post", body.FormData ?? new Dictionary <string, string>());

            addDictionaryLocator(RequestDataSource.Header.ToString(), body.Headers());
        }
Пример #7
0
        private static IDictionary<string, string> valuesForRequest(OwinRequestBody body)
        {
            var dictionary = new Dictionary<string, string>();
            var queryString = body.Querystring();
            foreach(var key in queryString.Keys)
            {
                dictionary.Add(key, queryString[key]);
            }

            IDictionary<string, string> formData = body.FormData ?? new Dictionary<string, string>();
            foreach (var key in formData.Keys.Where(x => x != null))
            {
                if(!dictionary.ContainsKey(key))
                {
                    dictionary.Add(key, formData[key]);
                }
            }

            return dictionary;
        }
Пример #8
0
        private static IDictionary <string, string> valuesForRequest(OwinRequestBody body)
        {
            var dictionary  = new Dictionary <string, string>();
            var queryString = body.Querystring();

            foreach (var key in queryString.Keys)
            {
                dictionary.Add(key, queryString[key]);
            }

            IDictionary <string, string> formData = body.FormData ?? new Dictionary <string, string>();

            foreach (var key in formData.Keys.Where(x => x != null))
            {
                if (!dictionary.ContainsKey(key))
                {
                    dictionary.Add(key, formData[key]);
                }
            }

            return(dictionary);
        }