Given a set of key-value pairs, I would expect these two pieces of code to produce a similar result, they do not:
var content = new MultipartFormDataContent();
var values = new[] { new KeyValuePair<string, string>("Foo", "Bar"), };
content.Add(new FormUrlEncodedContent(values));
vs. this:
var content = new MultipartFormDataContent();
var values = new[] { new KeyValuePair<string, string>("Foo", "Bar"), };
foreach (var keyValuePair in values)
{
content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
}
The latter creates the same request structure a browser form would. The former does not.
Comments: The original issue was by design. And the second suggestion is on a class that this project does not own. We will communicate this suggestion to the right team.
var content = new MultipartFormDataContent();
var values = new[] { new KeyValuePair<string, string>("Foo", "Bar"), };
content.Add(new FormUrlEncodedContent(values));
vs. this:
var content = new MultipartFormDataContent();
var values = new[] { new KeyValuePair<string, string>("Foo", "Bar"), };
foreach (var keyValuePair in values)
{
content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
}
The latter creates the same request structure a browser form would. The former does not.
Comments: The original issue was by design. And the second suggestion is on a class that this project does not own. We will communicate this suggestion to the right team.