有谁知道如何设置GET异步请求的内容类型? 我尝试发送API的GET异步请求,但无法确定如何将内容类型设置为" application / x-www-form-urlencoded"。
这是邮递员的定义:Encode GET request 这是Postman的结果:202 response
static HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://api.domain.com/");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync("api/location/trackInfo?" + filter.URLQuery);
response.EnsureSuccessStatusCode();
if (response.IsSuccessStatusCode)
{
trackInfo = await response.Content.ReadAsAsync<List<TrackingInformation>>();
}