Search code examples
rubyuser-agentrest-client

How do I set the user agent for Ruby's RestClient?


I'm interested in setting my own user agent when using the ruby RestClient gem.

http://github.com/archiloque/rest-client

However, I can't find any documentation on how to do so. Any pointers?


Solution

  • RestClient.get 'http://localhost', :user_agent => "myagent"
    

    See https://github.com/rest-client/rest-client/blob/master/lib/restclient.rb