Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only drop the body of the request if it is a GET, typhoeus#75

  • Loading branch information...
commit dd300a7134b168d6d7f1bd37202cb97800014868 1 parent 86c07fe
@whoahbot authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/typhoeus/hydra.rb
  2. +1 −1  spec/typhoeus/hydra_spec.rb
View
2  lib/typhoeus/hydra.rb
@@ -168,7 +168,7 @@ def get_easy_object(request)
else
easy.headers = {'User-Agent' => Typhoeus::USER_AGENT}
end
- easy.request_body = request.body unless request.body.nil?
+ easy.request_body = request.body unless request.method == :get || request.body.nil?
easy.timeout = request.timeout if request.timeout
easy.connect_timeout = request.connect_timeout if request.connect_timeout
easy.interface = request.interface if request.interface
View
2  spec/typhoeus/hydra_spec.rb
@@ -50,7 +50,7 @@ def set(key, object, timeout = 0)
end
describe "the body of the request" do
- [:post, :put, :delete, :get, :head, :patch, :options, :trace, :connect].each do |method|
+ [:post, :put, :delete, :head, :patch, :options, :trace, :connect].each do |method|
it "should not remove the body of the request, when the request is a #{method.upcase}" do
request = Typhoeus::Request.new("fubar", :method => method, :body => "kill the body and you kill the head")
hydra.send(:get_easy_object, request).request_body.should == "kill the body and you kill the head"
Please sign in to comment.
Something went wrong with that request. Please try again.