Ejemplo n.º 1
0
        private IEnumerable <KeyValuePair <string, string> > GetFormData(HttpContent content)
        {
            if (content is MultipartFormDataContent)
            {
                return(((MultipartFormDataContent)content)
                       .Where(CanProcessContent)
                       .SelectMany(GetFormData));
            }

            string rawFormData = content.ReadAsStringAsync().Result;

            return(QueryStringMatcher.ParseQueryString(rawFormData));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a new instance of FormDataMatcher using a formatted query string
 /// </summary>
 /// <param name="formData">Formatted form data (key=value&amp;key2=value2)</param>
 /// <param name="exact">When true, requests with form data values not included in <paramref name="formData"/> will not match. Defaults to false</param>
 public FormDataMatcher(string formData, bool exact = false)
     : this(QueryStringMatcher.ParseQueryString(formData), exact)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructs a new instance of FormDataMatcher using a formatted query string
 /// </summary>
 /// <param name="formData">Formatted form data (key=value&amp;key2=value2)</param>
 public FormDataMatcher(string formData)
     : this(QueryStringMatcher.ParseQueryString(formData))
 {
 }