I'm developing rest api client using RestSharp.NetCore 105.2.3 on .net core 1.1. When i send request (POST, GET), response from server is not encoded with gzip. When i do the same thing with RestSharp 105.2.3 on .net 4.5.2 (not core), it works correctly and response is encoded with gzip.
Cource code identical on both frameworks
internal class Program
{
private static void Main(string[] args)
{
//my test Api supports gzip
var target = "http://10.100.0.92:62872/api/TestZipPost";
var client = new RestClient(target);
var request = new RestRequest(Method.POST);
var response = new RestResponse();
Task.Run(async () => { response = await GetResponseContentAsync(client, request) as RestResponse; }).Wait();
//write response "AAAAAAAAA"
Console.WriteLine(response.Content);
}
public static Task<IRestResponse> GetResponseContentAsync(RestClient theClient, RestRequest theRequest)
{
var tcs = new TaskCompletionSource<IRestResponse>();
theClient.ExecuteAsync(theRequest, response => { tcs.SetResult(response); });
return tcs.Task;
}
}
Request headers on Core:
POST /api/TestZipPost HTTP/1.1 Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml Connection: Keep-Alive Content-Length: 0 Host: 10.100.0.92:62872
Request headers on .net 4.5.2
POST /api/TestZipPost HTTP/1.1 Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml User-Agent: RestSharp/105.2.3.0 Host: 10.100.0.92:62872 Content-Length: 0 Accept-Encoding: gzip, deflate Connection: Keep-Alive
Is it a bug or i do something wrong? How can i achieve gzip encoding with RestSharop.NetCore?