-
Notifications
You must be signed in to change notification settings - Fork 321
Compression
No GUI edited this page Apr 7, 2018
·
3 revisions
The HTTP.use(:auto_deflate)
option can be used for automatically compressing the request body before writing it to the socket:
response = HTTP.use(:auto_deflate)
.post("http://example.org/upload", body: body)
By default gzip
encoding will be used, but deflate
is also supported:
response = HTTP.use(:auto_deflate => {:method => :deflate})
.post("http://example.org/upload", body: body)
The HTTP.use(:auto_inflate)
option can be used for automatically decompressing the response body:
response = HTTP.use(:auto_inflate).headers("Accept-Encoding" => "gzip")
.get("http://example.org/large-file")