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:
parent
756310fc65
commit
49956a707e
2 changed files with 6 additions and 9 deletions
|
@ -51,15 +51,14 @@ module HTTParty
|
|||
def configure_basic_auth
|
||||
@raw_request.basic_auth(options[:basic_auth][:username], options[:basic_auth][:password])
|
||||
end
|
||||
|
||||
def body
|
||||
options[:body].is_a?(Hash) ? options[:body].to_params : options[:body]
|
||||
end
|
||||
|
||||
def setup_raw_request
|
||||
@raw_request = http_method.new(uri.request_uri)
|
||||
|
||||
if post? && options[:query]
|
||||
@raw_request.set_form_data(options[:query])
|
||||
end
|
||||
|
||||
@raw_request.body = options[:body].is_a?(Hash) ? options[:body].to_params : options[:body] unless options[:body].blank?
|
||||
@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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue