diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-05-16 14:44:30 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-05-16 14:44:30 +0000 |
commit | 778df38c0991aef8de53702e8c6229dd6f43d1a2 (patch) | |
tree | 3fc19f78365174509517802d5f9c28f50b088366 | |
parent | 153a19bc26e1a9dac35d286b90037bfc9d0e9c6b (diff) |
uri_available? fixed in helper.rb
-rw-r--r-- | lib/helper.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/helper.rb b/lib/helper.rb index af92419..3a6126a 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -44,14 +44,8 @@ helpers do def uri_available?(urlStr) url = URI.parse(urlStr) - unless @subjectid - Net::HTTP.start(url.host, url.port) do |http| - return http.head(url.request_uri).code == "200" - end - else - Net::HTTP.start(url.host, url.port) do |http| - return http.post(url.request_uri, "subjectid=#{@subjectid}").code == "202" - end + Net::HTTP.start(url.host, url.port) do |http| + return http.head("#{url.request_uri}?subjectid=#{CGI.escape @subjectid}").code == "200" end end |