Class: Selenium::WebDriver::Remote::Http::Common Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/remote/http/common.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

Curb, Default

Constant Summary collapse

MAX_REDIRECTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

same as chromium/gecko

20
CONTENT_TYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"application/json"
DEFAULT_HEADERS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{ "Accept" => CONTENT_TYPE }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommon

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Common.



32
33
34
# File 'lib/selenium/webdriver/remote/http/common.rb', line 32

def initialize
  @timeout = nil
end

Instance Attribute Details

#server_url=(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
# File 'lib/selenium/webdriver/remote/http/common.rb', line 30

def server_url=(value)
  @server_url = value
end

#timeoutObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/selenium/webdriver/remote/http/common.rb', line 29

def timeout
  @timeout
end

Instance Method Details

#call(verb, url, command_hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/selenium/webdriver/remote/http/common.rb', line 40

def call(verb, url, command_hash)
  url      = server_url.merge(url) unless url.kind_of?(URI)
  headers  = DEFAULT_HEADERS.dup
  headers['Cache-Control'] = "no-cache" if verb == :get

  if command_hash
    payload                   = WebDriver.json_dump(command_hash)
    headers["Content-Type"]   = "#{CONTENT_TYPE}; charset=utf-8"
    headers["Content-Length"] = payload.bytesize.to_s if [:post, :put].include?(verb)

    if $DEBUG
      puts "   >>> #{url} | #{payload}"
      puts "     > #{headers.inspect}"
    end
  elsif verb == :post
    payload = "{}"
    headers["Content-Length"] = "2"
  end

  request verb, url, headers, payload
end

#closeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/selenium/webdriver/remote/http/common.rb', line 36

def close
  # hook for subclasses - will be called on Driver#quit
end