I have a .NET Core 2.0 console application that executes a GET request.
It seems that the published version does not send headers Accept-Encodingfor compression on the test computer, but it works on my local machine.
I cannot find any other preliminary requests that could make the compression fail. Both of them support the .NET Core 2.1.4 SDK.
I tested the console application by running dotnet Console.dllin both environments.
- Post to VS2017
- Go to the output folder and run
dotnet Console.dll. Confirm the title present in Fiddler. - Copy the entire output folder and deploy to the server
- Run
dotnet Console.dllagain and check for a missing header on the server using Fiddler.
I tried both HttpClient, and RestSharpand I am very puzzled.
A proof of concept that goes to a page that resonates with the request headers:
var handler = new HttpClientHandler()
{
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
};
using (var client = new HttpClient(handler))
{
response = client.GetStringAsync("http://scooterlabs.com/echo").Result;
}
Local Environment (Win10)
GET http://scooterlabs.com/echo HTTP/1.1
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Host: scooterlabs.com
Server (Win2008 R2 on AWS)
GET http://scooterlabs.com/echo HTTP/1.1
Connection: Keep-Alive
Host: scooterlabs.com
source
share