$ curl -H 'Accept-Encoding: gzip' http://staff.livedoor.blog/ > x1
$ crystal test.cr > x2
$ LC_ALL=C ls -l x1 x2
-rw-rw-r-- 1 maiha maiha 13786 Feb 10 10:00 x1
-rw-rw-r-- 1 maiha maiha 13602 Feb 10 10:06 x2
$ file x1 x2
x1: gzip compressed data, last modified: Sun Feb 10 01:00:48 2019, from Unix
x2: data
$ crystal --version
Crystal 0.27.0 [c9d1eef8f] (2018-11-01)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
Last active
February 10, 2019 01:10
-
-
Save maiha/e1aa1c207a8e8ba44111470ff766f4e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "http/client" | |
client = HTTP::Client.new("staff.livedoor.blog") | |
headers = HTTP::Headers{"Accept-Encoding" => "gzip"} | |
print client.get("/", headers).body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment