mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Process dynamic headers after merging all the headers
This commit is contained in:
parent
507ed9af53
commit
0cb0d873e8
2 changed files with 3 additions and 3 deletions
|
@ -565,8 +565,8 @@ module HTTParty
|
|||
|
||||
def process_headers(options)
|
||||
if options[:headers] && headers.any?
|
||||
options[:headers] = process_dynamic_headers(options[:headers])
|
||||
options[:headers] = headers.merge(options[:headers])
|
||||
options[:headers] = process_dynamic_headers(options[:headers])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -148,9 +148,9 @@ RSpec.describe HTTParty do
|
|||
init_headers = {'foo' => lambda {'bar'}}
|
||||
@klass.headers init_headers
|
||||
|
||||
stub_request(:get, "http://example.com/").with(headers: {'foo' => 'bar'})
|
||||
stub_request(:get, "http://example.com/").with(headers: {'foo' => 'bar', 'baz' => 'spax'})
|
||||
|
||||
@klass.get('http://example.com/')
|
||||
@klass.get('http://example.com/', headers: {baz: -> {'spax'}})
|
||||
expect(@klass.headers).to eq(init_headers)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue