Skip to content

Instantly share code, notes, and snippets.

@maiha
Last active February 10, 2019 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiha/e1aa1c207a8e8ba44111470ff766f4e7 to your computer and use it in GitHub Desktop.
Save maiha/e1aa1c207a8e8ba44111470ff766f4e7 to your computer and use it in GitHub Desktop.
$ 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
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