I am trying to post a request with following code, I have this code which fails (server complains bad request, as I have no control over server so dont know what server does.)
private static readonly HttpClient client = new HttpClient();
var values = new Dictionary<string, string>{
{ "x", "value" }};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(postUrl, content);
and then I have this code which works
private static readonly HttpClient client = new HttpClient();
var values = new Dictionary<string, string>{
{ "x", "\"value\"" }};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(postUrl, content);
Only difference is my value has extra "" around it. Can anyone please why it is happening? Or if I should have used something else?
x=value; the second posts a body ofx=%22value%22. What any particular server does with those bodies is up to that server.