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_urlprovided when ruby_lib _core created a default http client.
Constructor Details
#initialize(open_timeout: nil, read_timeout: nil) ⇒ Default
override
33 34 35 36 37 38 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 33 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.
30 31 32 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 30 def additional_headers @additional_headers end |
Instance Method Details
#request(verb, url, headers, payload, redirects = 0) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 60 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
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/appium_lib_core/common/base/http_default.rb', line 49 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.start_with?('/') ? path : "/#{path}" path = path.end_with?('/') ? path : "#{path}/" @http = nil @server_url = URI.parse "#{scheme}://#{host}:#{port}#{path}" end |