c# - HttpClient truncate response content -
i did request using httpclient. 1 content-type:application/json , other 1 content-type:application/xml.
here code:
httpclient client = new httpclient(); httprequestmessage request = new httprequestmessage(); request.method = httpmethod.post; request.headers.accept.add(new system.net.http.headers.mediatypewithqualityheadervalue("application/xml")); request.content = new stringcontent(bodycontent, encoding.utf8, "application/xml"); client.baseaddress = new uri(baseurl); var response = await client.sendasync(request, httpcompletionoption.responsecontentread); var responsetext = await response.content.readasstringasync(); result = responsetext.tostring(); client.dispose(); request.dispose(); this code works when content type json, return truncated response contents when comes content type xml. in case, returned string content json longer xml.
here example of response example.xml
do have idea why happening?
Comments
Post a Comment