Last Updated: February 25, 2016
· hernan604

perl http request with accept encoding "gzip"

The following gist shows an example of a perl http request with gzip compression active for the received content. And when the content is gziped, it must be decompressed too.

If you have some perl http request and you have not yet enabled gzip compression on your requests, you can do so following the simple instructions:

my useragent will be HTTP::Tiny by default, but these settings can serve as base for any user agent interface.

  1. Instanciate your useragent with defaultheaders options, so it accepts gzip by default ie:
    headers => {
    'Accept-Encoding' => 'gzip'

  2. decompress the content (see method decompress on the link below)

see the code: https://gist.github.com/hernan604/7083667