tourbus
tourbus copied to clipboard
bad URI(is not URI?)
Hi David,
I'm trying to use tourbus for some performance testing but am running into the following error :
2013-02-10 23:39:42 Runner #1: bad URI(is not URI?): %257B:url=%253E%2522http://localhost:3000/%2522,%2520:headers=%253Enil%257D
My tourist class is as follows:
class Simple < Tourist def tour_home visit "http://localhost:3000" assert_contain "Log In" end end
If this is a config error on my side I apologize, I'm working on sanding down my n00b edges!
Thanks,
Scott
I'm having the same issue, researching it. It appears to be an encoding/decoding issue. This is interesting:
1.9.3-p327 :031 > URI::decode("%257B:url=%253E%2522http://localhost:3000/%2522,%2520:headers=%253Enil%257D")
=> "%7B:url=%3E%22http://localhost:3000/%22,%20:headers=%3Enil%7D"
1.9.3-p327 :032 > URI::decode("%7B:url=%3E%22http://localhost:3000/%22,%20:headers=%3Enil%7D")
=> "{:url=>\"http://localhost:3000/\", :headers=>nil}"
..It appears that something is being URL-encoded twice before being passed to mechanize. Not sure why, but this s a start.
Ok, I found the root of the issue. The gemspec requires "mechanize" version >= 1.0.0. The current version of "mechanize" is 2.5.x and the the syntax of the "get" method has changed from 1.0.0 to now.
The tourbus gemspec should probably use "~> 1.0.0" instead of "=> 1.0.0", or patch the code to use the newer version of mechanize.
There is a work-around that I have found:
uninstall the the mechanize gem, and then explicitly install the mechanize 1.0.0 gem:
gem install mechanize -v="1.0.0"
Awesome, thanks for the work around Matt!
Scott
On Feb 12, 2013, at 6:38 PM, Matthew Nielsen [email protected] wrote:
Ok, I found the root of the issue. The gemspec requires "mechanize" version >= 1.0.0. The current version of "mechanize" is 2.5.x and the the syntax of the "get" method has changed from 1.0.0 to now.
The tourbus gemspec should probably use "~> 1.0.0" instead of "=> 1.0.0", or patch the code to use the newer version of mechanize.
There is a work-around that I have found:
uninstall the the mechanize gem, and then explicitly install the mechanize 1.0.0 gem:
gem install mechanize -v="1.0.0" — Reply to this email directly or view it on GitHub.
Depending on an ancient version of mechanize prevents the ability to include the tourbus in the Gemfile for Rails projects,
I removed the webrat_headers_patch.rb and it works well with mechanize 2.x now, I am not sure what the original monkey patch tried to do though and if any function is lost now - https://github.com/bbozo/tourbus/tree/make_tourbus_compatible_with_mechanize_2 (commit is named funny, it seemed to me that I was fixing webrat compatibility at the time)