Hiya!

I did see that in the docs but I was unable to figure how to properly 
use it, and my searching for any examples turned up nothing...  
Specifically, I am unsure how to access some of the data that needs to 
be passed, such as the request object. The reference to cur_page also 
confuses me as the page object is what is returned from a get or post 
call, but I need to set the headers before the post is called... All in 
all, no idea how to properly use the method... :(

Thanks
-Andy


Jes Gabriel y Gal wrote:
> On Tue, Apr 15, 2008 at 8:22 PM, Andrew Cowan <icculus / gmdstudios.com> wrote:
>   
>> Thanks Shawn, I wish it did help. I need a way to set custom request
>> headers, from what I can tell Mechanize doesn't have a public method for
>> doing that, so I may likely have to revert to net/http instead. Was hoping I
>> was wrong and was just missing something... ;)
>>     
>
> I found this in the docs:
>
> http://mechanize.rubyforge.org/mechanize/
>
> go to the CHANGELOG.txt file, and there you can find this:
>
> 0.6.4
> [...]
>     * Added protected method Mechanize#set_headers so that subclasses
> can set custom headers.
> rubyforge.org/tracker/?func=detail&aid=7208&group_id=1453&atid=5712
>
> If you follow the link to the tracker you can see an example:
>
> Mechanize can now be subclassed to add any headers a user may
> want.  For example:
>
>   class A < WWW::Mechanize
>     def set_headers(u, r, c)
>       super(uri, request, cur_page)
>       request.add_field('Cookie', 'name=Aaron')
>       request
>     end
>   end
>
> I haven't been able to test it, but it seems you can use this to
> achieve what you want. Beware that in the example the params of the
> method should actually be uri, request, cur_page instead of u,r,c.
>
> Hope this helps,
>
> Jesus.
>
>
>
>