mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Fix bug where default_options are unexpectedly modified
This commit is contained in:
parent
a320dfbf6e
commit
432b2b29da
2 changed files with 8 additions and 1 deletions
|
@ -515,7 +515,7 @@ module HTTParty
|
|||
private
|
||||
|
||||
def perform_request(http_method, path, options, &block) #:nodoc:
|
||||
options = default_options.merge(options)
|
||||
options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
|
||||
process_headers(options)
|
||||
process_cookies(options)
|
||||
Request.new(http_method, path, options).perform(&block)
|
||||
|
|
|
@ -186,6 +186,13 @@ describe HTTParty do
|
|||
@klass.get('', cookies: {type: 'snickerdoodle'})
|
||||
end
|
||||
|
||||
it 'doesnt modify default_options' do
|
||||
@klass.headers.should == {}
|
||||
expect_headers('cookie' => 'type=snickerdoodle')
|
||||
@klass.get('', cookies: {type: 'snickerdoodle'})
|
||||
@klass.default_options[:headers].should == {}
|
||||
end
|
||||
|
||||
it 'adds optional cookies to the optional headers' do
|
||||
expect_headers(baz: 'spax', 'cookie' => 'type=snickerdoodle')
|
||||
@klass.get('', cookies: {type: 'snickerdoodle'}, headers: {baz: 'spax'})
|
||||
|
|
Loading…
Add table
Reference in a new issue