示例#1
0
        private void ParseRequestFormDataParameters(string formData)
        {
            // Parse multiple parameters
            if (formData == GlobalConstants.HttpNewLine)
            {
                return;
            }

            string[] pairs = formData.Split('&', StringSplitOptions.RemoveEmptyEntries);

            foreach (var pair in pairs)
            {
                string[] queryPair = pair.Split('=');
                string   key       = queryPair[0];
                string   value     = queryPair[1];

                CoreValidator.ThrowIfNullOrEmptyInRequestBody(key, nameof(key));
                CoreValidator.ThrowIfNullOrEmptyInRequestBody(value, nameof(value));

                if (!this.FormData.ContainsKey(key))
                {
                    this.FormData.Add(key, new List <string>());
                }

                ((IList <string>) this.FormData[key]).Add(value);

                // this.FormData.Add(key, value);
            }
        }