From 710031f953429c6e1a76aff4984ee76f7a1ee485 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 9 Jun 2017 11:08:45 +0000 Subject: added addressable gem to avoid URI::InvalidURIError --- lib/lazar.rb | 1 + lib/overwrite.rb | 2 +- lib/rest-client-wrapper.rb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/lazar.rb b/lib/lazar.rb index a756742..fff5598 100644 --- a/lib/lazar.rb +++ b/lib/lazar.rb @@ -1,6 +1,7 @@ require 'rubygems' require "bundler/setup" require "rest-client" +require 'addressable' require 'yaml' require 'json' require 'logger' diff --git a/lib/overwrite.rb b/lib/overwrite.rb index 91bc9e1..89e57a0 100644 --- a/lib/overwrite.rb +++ b/lib/overwrite.rb @@ -197,7 +197,7 @@ module URI # @param [String] # @return [TrueClass,FalseClass] def self.valid? uri - u = URI.parse(uri) + u = Addressable::URI.parse(uri) u.scheme!=nil and u.host!=nil rescue URI::InvalidURIError false diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb index f76a296..c9fd40f 100644 --- a/lib/rest-client-wrapper.rb +++ b/lib/rest-client-wrapper.rb @@ -26,6 +26,7 @@ module OpenTox define_singleton_method method do |uri,payload={},headers={},waiting_task=nil| + uri = Addressable::URI.encode(uri) # check input bad_request_error "Headers are not a hash: #{headers.inspect} for #{uri}." unless headers==nil or headers.is_a?(Hash) headers[:subjectid] ||= @@subjectid -- cgit v1.2.3