如何使用SendAsync重新创建PostAsync?

时间:2019-03-26 22:11:38

标签: httpclient

更清楚

public void myFunc(string url, object obj) {
  var client = new HttpClient();
  client.PostAsync(url,obj);
}

如果我想使用SendAsync重新创建该代码,我该怎么做?

public void myFunc(string url, object obj) {
  var client = new HttpClient();
  var request = new HttpRequestMessage() {
    RequestUri = new Uri(url),
    Method =  HttpMethod.Post,
    Content = ??
  };
  client.SendAsync(request);
}

我不清楚在这种情况下PostAsync会做什么

0 个答案:

没有答案