6
从Web API使用HttpClient发布JsonObject
我正在尝试JsonObject通过HttpClientWeb API发布。我不太确定该怎么做,在示例代码中找不到太多。 这是我到目前为止的内容: var myObject = (dynamic)new JsonObject(); myObject.Data = "some data"; myObject.Data2 = "some more data"; HttpClient httpClient = new HttpClient("myurl"); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = httpClient.Post("", ???); 我想我需要把我JsonObject当成演员,StreamContent但是我对此很挂念。