File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,30 @@ def inspect
102102 "\# <#{ self . class } #{ @method } >"
103103 end
104104
105+ # Returns a string representation of the request with the details for pp:
106+ #
107+ # require 'pp'
108+ # Net::HTTP::Post.new(uri).pretty_inspect
109+ # # => #<Net::HTTP::Get
110+ # GET
111+ # path="/"
112+ # headers={"accept-encoding"=>
113+ # ["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
114+ # "accept"=>["*/*"],
115+ # "user-agent"=>["Ruby"]}>
116+ # Net::HTTP::Post.new(uri).inspect # => "#<Net::HTTP::Post POST>"
117+ #
118+ def pretty_print ( q )
119+ q . object_group ( self ) {
120+ q . breakable
121+ q . text @method
122+ q . breakable
123+ q . text "path=" ; q . pp @path
124+ q . breakable
125+ q . text "headers=" ; q . pp to_hash
126+ }
127+ end
128+
105129 ##
106130 # Don't automatically decode response content-encoding if the user indicates
107131 # they want to handle it.
You can’t perform that action at this time.
0 commit comments