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)); }
/// <summary> /// Constructs a new instance of FormDataMatcher using a formatted query string /// </summary> /// <param name="formData">Formatted form data (key=value&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) { }
/// <summary> /// Constructs a new instance of FormDataMatcher using a formatted query string /// </summary> /// <param name="formData">Formatted form data (key=value&key2=value2)</param> public FormDataMatcher(string formData) : this(QueryStringMatcher.ParseQueryString(formData)) { }