Can you set a custom user-agent?

I was wondering how I could set a custom user-agent for all of my API
requests from ActiveResource? Basically, I want to identify my
application when ever I hit someone’s API from ActiveResource.

Thanks!
Tom

Disclaimer - I haven’t tried this, but it should work:

class Person < ActiveResource::Base
self.site = “http://api.people.com:3000/
self.headers[“User-agent”] = “MyUser/agent v1.0”
end

ActiveResource::Base#headers returns a hash, so it should be as easy as
that.

http://api.rubyonrails.org/classes/ActiveResource/Base.html#M000890

Cheers,

Andy


Andy J.
http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS
Company number: 5452840