123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::DevTools::Response

Relationships & Source Files
Inherits: Object
Defined in: rb/lib/selenium/webdriver/devtools/response.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(id:, code:, body:, headers:) ⇒ Response

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 43

def initialize(id:, code:, body:, headers:)
  @id = id
  @code = code
  @body = body
  @headers = headers
end

Class Method Details

.from(id, encoded_body, params)

This method is for internal use only.

Creates response from ::Selenium::WebDriver::DevTools message.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 32

def self.from(id, encoded_body, params)
  new(
    id: id,
    code: params['responseStatusCode'],
    body: (Base64.strict_decode64(encoded_body) if encoded_body),
    headers: params.fetch('responseHeaders', []).each_with_object({}) do |header, hash|
      hash[header['name']] = header['value']
    end
  )
end

Instance Attribute Details

#body (rw)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 24

attr_accessor :code, :body, :headers

#code (rw)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 24

attr_accessor :code, :body, :headers

#headers (rw)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 24

attr_accessor :code, :body, :headers

#id (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 25

attr_reader :id

Instance Method Details

#==(other)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 50

def ==(other)
  self.class == other.class &&
    id == other.id &&
    code == other.code &&
    body == other.body &&
    headers == other.headers
end

#inspect

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/devtools/response.rb', line 58

def inspect
  %(#<#{self.class.name} @id="#{id}" @code="#{code}")
end