简体   繁体   中英

Get Response Data in XML format in IRestResponse response = client.Execute(request);

I am using restsharp client to execute the restful API. I want to get response data in XML format while executing the restful API.

IRestResponse response = client.Execute(request);

API returns the 'XML' format. Many thanks in advance for any help you can provide.

I found the solution. Need to add the header parameter in the request. Please see the below code.

request.AddHeader("Accept", "text/xml");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM