
Webrat with Mechanize - Form data getting url encoded twice
Reported by Matt Fawcett | May 29th, 2009 @ 06:29 AM
Hi, Im using Cucumber with Webrat/Mechanize to test a PHP application and have run into an issue when submitting a form. Webrat url encodes the form values of a text field in the to_param method (field.rb) but when it gets passed through to the mechanize gem, it gets url encoded again. This happens in util.rb in the build_query_string method.
The result is that if you fill in say an email address, the server then receives a raw post of "sss%2540ss.com" instead of "sss%40ss.com". Iv changed the to_param method in field.rb so that if the configuration mode is :mechanize then it doesn't encode the value and lets mechanize take care of it.
Iv sent a pull request any my commit is at http://github.com/mattfawcett/webrat/commit/8d7944e4c13c8e54fbd1dc8...
Thanks
Matt
Comments and changes to this ticket
-
gaffo May 29th, 2009 @ 10:39 AM
- Tag changed from encode, mechanize, url to encode, mechanize, test!, url
- State changed from new to awaiting-patch
Matt,
Thanks for the post. Could you please add some specs showing that it works / what it does? -
josh.lubaway (at gmail) May 29th, 2009 @ 01:57 PM
I actually noticed this exact same issue yesterday, and wrote a very similar patch:
http://github.com/jish/webrat/commit/846a90e561a086cee072dc0fc135e6...
-
Bryan Helmkamp May 29th, 2009 @ 05:38 PM
- State changed from awaiting-patch to resolved
(from [6fc6530a6b3a2f3c77300f57172c3a180431c389]) [#256 state:resolved] Added attribution http://github.com/brynary/webrat/commit/6fc6530a6b3a2f3c77300f57172...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby Acceptance Testing for Web applications.
People watching this ticket
Referenced by
-
256 Webrat with Mechanize - Form data getting url encoded twice (from [6fc6530a6b3a2f3c77300f57172c3a180431c389]) [#256 s...