I have code that send HttpRequest and get json in string. The code work fine but it's contain diamond and unreadable string when server start sending tranfer-encoding chunked response
I have tried to use buffer and read the text into stringBuilder but it doesn't work well. I read in some answer that HttpWebRequest is obsolete and I should use HttpClient. I have rewrite my code in HttpClient but problem remain the same. I open the url in browser and it's work fine, it's took seconds to load and I didn't see transfer-encoding Chunked.
Please check the code,
HttpClientHandler handler = new HttpClientHandler();
handler.CookieContainer = cookies;
var client = new HttpClient(handler);
var ans = client.GetAsync(strURL).Result;
var resStream = ans.Content.ReadAsStringAsync().Result;
I have applied the 8192 byte buffer and read from SO, doesn't work with this code and tried many code from the SO in past few hours. Please check what is wrong in my code. can I set something in header to simple say no to chunked html or there is a way I can read the chunked html from the response.