ActiveResource: Howto use custom header fields

Hi,

I’m using the ActiveResource (beta) gem. I need to change the header
fields for the request.
There is “default_header” in ActiveResource::Connection which is
“Content-type: application/xml”. I do not see how to change that.
Could someone give me a hint.

TIA & regards,
chris

There is “default_header” in ActiveResource::Connection which is
“Content-type: application/xml”. I do not see how to change that.
Could someone give me a hint.

class Project < ActiveResource::Base
headers[‘X-Token’] = ‘foo’
end

Adds the X-Token header to all requests.

2007/5/2, DHH [email protected]:

Hello,

There is “default_header” in ActiveResource::Connection which is
“Content-type: application/xml”. I do not see how to change that.
Could someone give me a hint.

class Project < ActiveResource::Base
headers[‘X-Token’] = ‘foo’
end

Adds the X-Token header to all requests.

Thank you for your help. The “headers” methods isn’t yet included in
the ActiveResource gem. However, due to your hint, I downloaded at the
SVN sources and it works.

regards,
chris

Thank you for your help. The “headers” methods isn’t yet included in
the ActiveResource gem. However, due to your hint, I downloaded at the
SVN sources and it works.

Pushed the latest as beta gems.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs