Class: Selenium::WebDriver::Remote::Http::Common
- Inherits:
 - 
      Object
      
        
- Object
 - Selenium::WebDriver::Remote::Http::Common
 
 
- Defined in:
 - lib/selenium/webdriver/remote/http/common.rb
 
Constant Summary collapse
- MAX_REDIRECTS =
          
same as chromium/gecko
 20- CONTENT_TYPE =
 'application/json'- DEFAULT_HEADERS =
 { 'Accept' => CONTENT_TYPE, 'Content-Type' => "#{CONTENT_TYPE}; charset=UTF-8" }.freeze
Class Attribute Summary collapse
- 
  
    
      .extra_headers  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute extra_headers.
 - .user_agent ⇒ Object
 
Instance Attribute Summary collapse
- 
  
    
      #server_url  ⇒ Object 
    
    
  
  
  
  
    
    
      writeonly
    
  
  
  
  
  
  
    
Sets the attribute server_url.
 
Instance Method Summary collapse
- 
  
    
      #call(verb, url, command_hash)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
steep:ignore:start.
 - #close ⇒ Object
 - #quit_errors ⇒ Object
 
Class Attribute Details
.extra_headers ⇒ Object
Returns the value of attribute extra_headers.
      33 34 35  | 
    
      # File 'lib/selenium/webdriver/remote/http/common.rb', line 33 def extra_headers @extra_headers end  | 
  
Instance Attribute Details
#server_url=(value) ⇒ Object
Sets the attribute server_url
      41 42 43  | 
    
      # File 'lib/selenium/webdriver/remote/http/common.rb', line 41 def server_url=(value) @server_url = value end  | 
  
Instance Method Details
#call(verb, url, command_hash) ⇒ Object
steep:ignore:start
      52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69  | 
    
      # File 'lib/selenium/webdriver/remote/http/common.rb', line 52 def call(verb, url, command_hash) url = server_url.merge(url) unless url.is_a?(URI) headers = common_headers.dup headers['Cache-Control'] = 'no-cache' if verb == :get if command_hash payload = JSON.generate(command_hash) headers['Content-Length'] = payload.bytesize.to_s if %i[post put].include?(verb) WebDriver.logger.debug(" >>> #{url} | #{payload}", id: :command) WebDriver.logger.debug(" > #{headers.inspect}", id: :header) elsif verb == :post payload = '{}' headers['Content-Length'] = '2' end request verb, url, headers, payload end  | 
  
#close ⇒ Object
      47 48 49  | 
    
      # File 'lib/selenium/webdriver/remote/http/common.rb', line 47 def close # hook for subclasses - will be called on Driver#quit end  | 
  
#quit_errors ⇒ Object
      43 44 45  | 
    
      # File 'lib/selenium/webdriver/remote/http/common.rb', line 43 def quit_errors [IOError] end  |