1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

:query option no longer sets form data on post requests. Use :body option from now on.

This commit is contained in:
John Nunemaker 2009-07-19 18:42:52 -04:00
parent 756310fc65
commit 49956a707e
2 changed files with 6 additions and 9 deletions

View file

@ -52,14 +52,13 @@ module HTTParty
@raw_request.basic_auth(options[:basic_auth][:username], options[:basic_auth][:password])
end
def setup_raw_request
@raw_request = http_method.new(uri.request_uri)
if post? && options[:query]
@raw_request.set_form_data(options[:query])
def body
options[:body].is_a?(Hash) ? options[:body].to_params : options[:body]
end
@raw_request.body = options[:body].is_a?(Hash) ? options[:body].to_params : options[:body] unless options[:body].blank?
def setup_raw_request
@raw_request = http_method.new(uri.request_uri)
@raw_request.body = body if body
@raw_request.initialize_http_header options[:headers]
configure_basic_auth if options[:basic_auth]

View file

@ -114,7 +114,6 @@ describe HTTParty::Request do
end
describe 'with non-200 responses' do
it 'should return a valid object for 4xx response' do
stub_response '<foo><bar>yes</bar></foo>', 401
resp = @request.perform
@ -130,7 +129,6 @@ describe HTTParty::Request do
resp.body.should == "<foo><bar>error</bar></foo>"
resp['foo']['bar'].should == "error"
end
end
end