Skip to content

Instantly share code, notes, and snippets.

@ByteDev
Last active July 16, 2021 10:00
Show Gist options
  • Save ByteDev/178718508e96ffaca53d15e425247ebb to your computer and use it in GitHub Desktop.
Save ByteDev/178718508e96ffaca53d15e425247ebb to your computer and use it in GitHub Desktop.
// Tell HttpClient to auto decompress responses using the 
// particular compression method (e.g. GZip).
var client = new HttpClient(new HttpClientHandler
{
    AutomaticDecompression = DecompressionMethods.GZip
});

// ...

// Tell the API we only want responses in gzip format.
request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment