mysql - How can I parse this query url in ruby -


this query command in curl , can results expect

curl --data "action=search&user=wbt&project=test&ltoken=&query=build:tables_tempkb status:analyze" http://xxx.xxx.xxx:8088/review/api 

however, if try query in ruby

url = "http://xxx.xxx.xxx.xxx:8088/review/api/?action=search&user=wbt&project=test&ltoken=&query=build:tables_tempkb status:analyze" uri = uri(url) res = net::http.post_form(uri, 'q' => 'ruby') 

ruby reports parsing error below

bad uri(is not uri?): http://xxx.xxx.xxx.xxx:8088/review/api/?action=search&user=wbt&project=test&ltoken=&query=build:tables_tempkb status:analyze ["c:/ruby200/lib/ruby/2.0.0/uri/common.rb:176:in `split'", "c:/ruby200/lib/ruby/2.0.0/uri/common.rb:211:in `parse'", "c:/ruby200/lib/ruby/2.0.0/uri/common.rb:747:in `parse'", "c:/ruby200/lib/ruby/2.0.0/uri/common.rb:996:in `uri'" 

could let me know what's wrong ruby script?

convert space %20. works:

url = "http://xxx.xxx.xxx.xxx:8088/review/api/?action=search&user=wbt&project=test&ltoken=&query=build:tables_tempkb%20status:analyze" uri = uri(url) 

alternately, use + instead:

url = "http://xxx.xxx.xxx.xxx:8088/review/api/?action=search&user=wbt&project=test&ltoken=&query=build:tables_tempkb+status:analyze" uri = uri(url) 

both decoded in receiving application space.

see percent encoding.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -