I wonder if this code works as expected (send a string to a web application):
using (HttpClient httpClient = Util.CreateHttpClient()) { httpClient.PostAsJsonAsync("theurl", somestr); } Since PostAsJsonAsync doesn't complete execution immediately, and httpClient is disposed when exiting the block, is the request always sent properly?
Or do I have to wait for the task like this:
using (HttpClient httpClient = Util.CreateHttpClient()) { httpClient.PostAsJsonAsync("theurl", somestr).Wait(); }