Redirection and/or wrong request type with WWW:Mechanize and a rails app

44 views
Skip to first unread message

Maciej B

unread,
Feb 1, 2013, 8:47:49 AM2/1/13
to www-mecha...@googlegroups.com
Hello,

I'm trying to use WWW::Mechanize to navigate through a rails app and I've encountered some strange behaviour.
The application gives the administrative user the option to impersonate another user by following the route POST /owners/ownerid/impersonate, which I would like to use to automate some tedious manual tasks.

From within a WWW::Mechanize object I am using LWP::UA's post() method to try and emulate the browser, unfortunately when I do that I am being redirected to issue a GET request on the same resources with an auth token, which fails as there is no route to match a GET request like that, is there a way I could suppress that ? Am I doing something wrong ? The source of the element I'm trying to use is:

      <td class='options'><a href="http://companynamedotcom/owners/22/impersonate" data-method="post" rel="nofollow" title="Impersonate"><img alt="User-thief-baldie" src="/assets/fugue-icons/user-thief-baldie.png" /></a></td>

and it fails with:

Error GETing http://companynamedotcom/owners/13/impersonate?ticket=ST-bc8d1e03cdbc5658993c2ed1c5d72066c6056b03a8d258d89a420a5ff1f84: Not Found at .\script.pl line 34.

I would greatly appreciate any help.

Regards,
Maciej Bonin
Reply all
Reply to author
Forward
0 new messages