1
0
Fork 0
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:
AjitSingh 2018-08-18 09:46:23 +05:30
parent 507ed9af53
commit 0cb0d873e8
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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