CubicLouve

Spring_MTの技術ブログ

Faradayでnet/httpのアダプターを使っている場合のHTTPリクエスト/レスポンスを見る

忘れそうなのでメモっておく。

require 'faraday'
module FaradayDebug
  def net_http_connection(env)
    http = super
    http.set_debug_output $stderr
    http
  end
end


module Faraday
  class Adapter
    class NetHttp                                                                                                                                 
      prepend FaradayDebug
    end
  end
end

これを書いて実行すれば、HTTPリクエスト/レスポンスをダンプできた。