我有以下代码可以调用API。如何获取xml格式的响应?
public static void MakeCall()
{
var client = new HttpClient();
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "text/xml");
var httpRequestMessage = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://example.com"),
Headers = {
{ "book", "shinning" },
{ "user", "user@api.com" },
{ "pass", "secret" }
},
};
var response = client.SendAsync(httpRequestMessage).Result;
var msg = response.Content;
}