-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 156 - adding a default user agent. #176
Issue 156 - adding a default user agent. #176
Conversation
Thanks for your work! Is it possible to add the user agent without modifying the original options? |
I don't see how I have modified the original options...? :) |
When there are headers already, the hash is assigned to |
I'm setting the User-Agent in |
Sorry for not being clear. This is what I mean: def fubar(options)
headers = options[:headers]
headers['User-Agent'] = 'typhoeus'
end
options = {:headers => {}}
fubar(options)
p options
#=> {:headers=>{"User-Agent"=>"typhoeus"}} And I wanted you to duplicate the headers before changing it. Or something similar. |
Hi Hans, Thanks for your explanation, that makes sense. I'm not sure if the focus is to ensure the options hash isn't modified, or the @headers accessor. I think that we have to set @headers['User-Agent'] in the headers directly, rather than in the user_agent method, because it is the headers which will actually be used by Curl. I don't even think that user_agent method is used...? I'm pretty sure this isn't really what you're looking for, but I've marshalled the options to ensure they won't be modified and added some more specs. Let me know what you think! :) Cheers, |
Hi Steven, sorry for the back and forth and thanks for your patience. This is what I was looking for. Thanks! |
Cool. :) |
Issue 156 - adding a default user agent.
No description provided.