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

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)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) server_url=(value)

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.

Sets the attribute server_url

Parameters:

  • value

    the value to set the attribute server_url to.



17
18
19
# File 'lib/selenium/webdriver/remote/http/common.rb', line 17

def server_url=(value)
  @server_url = value
end

- (Object) timeout

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 the value of attribute timeout



16
17
18
# File 'lib/selenium/webdriver/remote/http/common.rb', line 16

def timeout
  @timeout
end

Class Method Details

+ (Object) timeout=(timeout)

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.

deprecated.



11
12
13
14
# File 'lib/selenium/webdriver/remote/http/common.rb', line 11

def self.timeout=(timeout)
  raise Error::WebDriverError,
    "Configuration of HTTP timeouts has changed. See http://code.google.com/p/selenium/wiki/RubyBindings for updated intructions."
end

Instance Method Details

- (Object) call(verb, url, command_hash)

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.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/selenium/webdriver/remote/http/common.rb', line 19

def call(verb, url, command_hash)
  url      = server_url.merge(url) unless url.kind_of?(URI)
  headers  = DEFAULT_HEADERS.dup

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

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

  request verb, url, headers, payload
end