lib/calabash-android/operations.rb in calabash-android-0.2.4 vs lib/calabash-android/operations.rb in calabash-android-0.2.5

- old
+ new

@@ -1,7 +1,8 @@ require 'json' require 'net/http' +require 'open-uri' require 'rubygems' require 'json' require 'socket' require 'timeout' require 'calabash-android/helpers' @@ -181,15 +182,20 @@ rescue Timeout::Error raise Exception, "Step timed out" end def http(path, data = {}) + retries = 0 begin http = Net::HTTP.new "127.0.0.1", @server_port - resp = http.post(path, "command=#{data.to_json}", {}) + cmd = "command=#{data.to_json}" + cmd = cmd.gsub("+", "%2B") + resp = http.post(path, cmd, {}) resp.body - rescue + rescue Exception => e + raise e if retries > 20 sleep 0.5 + retries += 1 retry end end def take_screenshot