lib/http-dump.rb in http-dump-0.1.0 vs lib/http-dump.rb in http-dump-0.2.0

- old
+ new

@@ -1,11 +1,11 @@ require "http-dump/version" class HTTPDump class << self - attr_accessor :output, :quiet_format + attr_accessor :output, :quiet_format, :output_encoding def enable!(options = {}) require 'webmock' WebMock.enable!(options) WebMock.allow_net_connect!(options) WebMock.after_request do |request_signature, response| @@ -48,10 +48,14 @@ res << tail.split("\n")[-1] else res << body end end - res.join("\n") + if @output_encoding + res.map{|d| d.force_encoding @output_encoding }.join("\n") + else + res.join("\n") + end end end end