问题描述
如果我尝试从 Post Man 请求,我得到 150Mb,但是如果我尝试从 Dotnet 代码请求,我得到 16Mb 数据作为响应,所以基本上如何增加 GET 请求的 HTTP 响应,标题是传输编码:分块
代码看起来像这样
private static void Download(string token)
{
HttpClient httpClient = new HttpClient();
httpClient.MaxResponseContentBufferSize = httpClient.MaxResponseContentBufferSize;
Uri uri = new Uri(StatusResponseType.Status_Response.Output[0].Url);
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",token);
try
{
HttpResponseMessage response = httpClient.GetAsync(uri,HttpCompletionoption.ResponseHeadersRead).Result;
string result = response.Content.ReadAsstringAsync().Result;
Console.WriteLine(result.Length);
File.WriteallText("Test_File",result);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)