Skip to content

Commit

Permalink
enable GET requests with body for Net::HTTP adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiren Patel authored and mislav committed Dec 30, 2011
1 parent 8f7f669 commit 6aecc5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/faraday/adapter/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def call(env)
http.read_timeout = http.open_timeout = req[:timeout] if req[:timeout]
http.open_timeout = req[:open_timeout] if req[:open_timeout]

if :get != env[:method]
if :get != env[:method] or env[:body]
http_request = Net::HTTPGenericRequest.new \
env[:method].to_s.upcase, # request method
!!env[:body], # is there request body
Expand All @@ -55,7 +55,7 @@ def call(env)
end

begin
http_response = if :get == env[:method]
http_response = if :get == env[:method] and env[:body].nil?
# prefer `get` to `request` because the former handles gzip (ruby 1.9)
http.get url.request_uri, env[:request_headers]
else
Expand Down

0 comments on commit 6aecc5d

Please sign in to comment.