lib/smoke/request.rb in benschwarz-smoke-0.3.6 vs lib/smoke/request.rb in benschwarz-smoke-0.3.7
- old
+ new
@@ -18,12 +18,17 @@
dispatch
end
private
def dispatch
+ opts = {
+ "User-Agent" => Smoke.config[:user_agent],
+ "Accept-Encoding" => "gzip"
+ }
Thread.new {
- open(@uri, "User-Agent" => "Ruby/#{RUBY_VERSION}/Smoke") do |request|
+ open(@uri, opts) do |request|
@content_type = request.content_type
+ request = Zlib::GzipReader.new(request) if request.content_encoding.include? "gzip"
@body = request.read
end
}.join
unless @options.include?(:raw_response)
\ No newline at end of file