Class: Appium::Core::Base::Http::Default
- Inherits:
-
Selenium::WebDriver::Remote::Http::Default
- Object
- Selenium::WebDriver::Remote::Http::Default
- Appium::Core::Base::Http::Default
- Defined in:
- lib/appium_lib_core/common/base/http_default.rb
Instance Attribute Summary collapse
-
#additional_headers ⇒ Object
readonly
Returns the value of attribute additional_headers.
Instance Method Summary collapse
-
#initialize(open_timeout: nil, read_timeout: nil) ⇒ Default
constructor
override.
- #request(verb, url, headers, payload, redirects = 0) ⇒ Object
-
#update_sending_request_to(scheme:, host:, port:, path:) ⇒ URI
Update
server_url
provided when ruby_lib _core created a default http client.
Constructor Details
#initialize(open_timeout: nil, read_timeout: nil) ⇒ Default
override
35 36 37 38 39 40 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 35 def initialize(open_timeout: nil, read_timeout: nil) @open_timeout = open_timeout @read_timeout = read_timeout @additional_headers = {} super end |
Instance Attribute Details
#additional_headers ⇒ Object (readonly)
Returns the value of attribute additional_headers.
32 33 34 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 32 def additional_headers @additional_headers end |
Instance Method Details
#request(verb, url, headers, payload, redirects = 0) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 62 def request(verb, url, headers, payload, redirects = 0) headers['User-Agent'] = "appium/ruby_lib_core/#{VERSION} (#{headers['User-Agent']})" headers = headers.merge @additional_headers unless @additional_headers.empty? super(verb, url, headers, payload, redirects) end |
#update_sending_request_to(scheme:, host:, port:, path:) ⇒ URI
Update server_url
provided when ruby_lib _core created a default http client. Set @http
as nil to re-create http client for the server_url
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 51 def update_sending_request_to(scheme:, host:, port:, path:) return @server_url unless validate_url_param(scheme, host, port, path) # Add / if 'path' does not have it path = "/#{path}" unless path.start_with?('/') path = "#{path}/" unless path.end_with?('/') @http = nil @server_url = URI.parse "#{scheme}://#{host}:#{port}#{path}" end |