418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
# File 'lib/calabash-android/operations.rb', line 418
def make_http_request(options)
begin
unless @http
@http = init_request(options)
end
= options[:header] || {}
["Content-Type"] = "application/json;charset=utf-8"
options[:header] =
response = if options[:method] == :post
@http.post(options[:uri], options)
else
@http.get(options[:uri], options)
end
raise Errno::ECONNREFUSED if response.status_code == 502
response.body
rescue => e
if @http
@http.reset_all
@http=nil
end
raise e
end
end
|