title: HttpClient vs RestSharp: how to make the same call
body: <p>I can do the call with the RestSharp tool and i receive the right response, but can i do the same thing with HTTPClient call ? My problem is how to format the values to send in post. I try with :</p>
  
  <pre><code>var values = new List&lt;KeyValuePair&lt;string, string&gt;&gt;
                  {
                      new KeyValuePair&lt;string, string&gt;("LocIdSbme_destination", "1386" ),
                      new KeyValuePair&lt;string, string&gt;("LocIdSbme_origin", "1459"),
                      new KeyValuePair&lt;string, string&gt;("arrival_date", "20151021 16:36:00"),
                      new KeyValuePair&lt;string, string&gt;("departure_date", "20151021 19:04:00"),
                      new KeyValuePair&lt;string, string&gt;("destination", "ABBIATEGRASSO"),
                      new KeyValuePair&lt;string, string&gt;("first_class_price", ""),
                      new KeyValuePair&lt;string, string&gt;("km_distance", "92"),
                      new KeyValuePair&lt;string, string&gt;("mir_destination", "S01062"),
                      new KeyValuePair&lt;string, string&gt;("mir_origin", "S01416"),
                      new KeyValuePair&lt;string, string&gt;("origin", "ABBADIA LARIANA"),
                      new KeyValuePair&lt;string, string&gt;("second_class_price", "4.8"),
                      new KeyValuePair&lt;string, string&gt;("train_ids", "[{\"train_category\": \"REG     \",\"train_id\":\"5279\"},{\"train_category\": \"REG     \",\"train_id\":\"2571\"},{\"train_category\": \"S       \",\"train_id\": \"24151\"},{\"train_category\": \"REG     \",\"train_id\": \"10539\"}]" ),
                      new KeyValuePair&lt;string, string&gt;("user_token",  "token"),
                      new KeyValuePair&lt;string, string&gt;("via_1", "1360"),
                      new KeyValuePair&lt;string, string&gt;("via_2", "1001")
                  };
  
                  var content = new FormUrlEncodedContent(values);
  
  
                  //var x = new StringContent("", Encoding.UTF8, "application/json");
  
  
                  var response = client.PostAsync("http://trenord.makeitapp.eu/nordcomstore", content).Result;
  
                  var responseString = response.Content.ReadAsStringAsync();
  </code></pre>
  
  <p>But this do not produce the same response as the RestSharp call</p>
  
  <pre><code>var client2 = new RestClient("http://cccc.xxxxx.eu/mymethod");
              var request2 = new RestRequest(Method.POST);
              request2.AddHeader("postman-token", "92ee3ab6-26a0-68e7-47e2-cbf888565111");
              request2.AddHeader("cache-control", "no-cache");
              request2.AddHeader("content-type", "application/json");
              request2.AddHeader("secret", "8717fe31eb803692a1241exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
              request2.AddParameter("application/json", "{    \"LocIdSbme_destination\":\"1386\",\r\n    \"LocIdSbme_origin\" : \"1459\",\r\n    \"arrival_date\" : \"20151021 16:36:00\",\r\n    \"departure_date\" : \"20151021 19:04:00\",\r\n    \"destination\" : \"ABBIATEGRASSO\",\r\n    \"first_class_price\": null,\r\n    \"km_distance\":92,\r\n    \"mir_destination\":\"S01062\",\r\n    \"mir_origin\": \"S01416\",\r\n    \"origin\":\"ABBADIA LARIANA\",\r\n    \"second_class_price\":\"4.8\",\r\n    \"train_ids\" :[\r\n       {\r\n            \"train_category\": \"REG     \",\r\n            \"train_id\":\"5279\"\r\n        },\r\n       {\r\n            \"train_category\": \"REG     \",\r\n            \"train_id\":\"2571\"\r\n        },\r\n        {\r\n            \"train_category\": \"S       \",\r\n            \"train_id\": \"24151\"\r\n        },\r\n\t\t{\r\n            \"train_category\": \"REG     \",\r\n            \"train_id\": \"10539\"\r\n        }\r\n    ],\r\n    \"user_token\":\"token\",\r\n    \"via_1\": \"1360\",\r\n    \"via_2\":\"1001\"\r\n}", ParameterType.RequestBody);
              IRestResponse response2 = client2.Execute(request2);
  </code></pre>
  
  <p>Thanks in advance to all of you</p>