Method: Calabash::Android::Operations::Device#http

Defined in:
lib/calabash-android/operations.rb

#http(path, data = {}, options = {}) ⇒ Object



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/calabash-android/operations.rb', line 381

def http(path, data = {}, options = {})
  begin

    configure_http(@http, options)
    make_http_request(
        :method => :post,
        :body => data.to_json,
        :uri => url_for(path),
        :header => {"Content-Type" => "application/json;charset=utf-8"})

  rescue HTTPClient::TimeoutError,
      HTTPClient::KeepAliveDisconnected,
      Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED,
      Errno::ETIMEDOUT => e
    log "It looks like your app is no longer running. \nIt could be because of a crash or because your test script shut it down."
    raise e
  end
end