class Ferrum::Network::Response
object.
Represents a [Network.Response](chromedevtools.github.io/devtools-protocol/1-3/Network/#type-Response)
def ==(other)
-
(Boolean)
-
def ==(other) id == other.id end
def body
-
(String)
-
def body @body ||= begin body, encoded = @page.command("Network.getResponseBody", requestId: id) .values_at("body", "base64Encoded") encoded ? Base64.decode64(body) : body end end
def body_size=(size)
`Network.loadingFinished` encodedDataLength contains both body and
See https://crbug.com/764946
Sometimes we never get the Network.responseReceived event.
See https://crbug.com/883475
def body_size=(size) @body_size = size - headers_size end
def content_type
-
(String, nil)
-
def content_type @content_type ||= headers.find { |k, _| k.downcase == "content-type" }&.last&.sub(/;.*\z/, "") end
def headers
-
(Hash{String => String})
-
def headers @response["headers"] end
def headers_size
-
(Integer)
-
def headers_size @response["encodedDataLength"] end
def id
-
(String)
-
def id @params["requestId"] end
def initialize(page, params)
-
params
(Hash{String => Object}
) -- -
page
(Page
) --
def initialize(page, params) @page = page @params = params @response = params["response"] || params["redirectResponse"] end
def inspect
-
(String)
-
def inspect %(#<#{self.class} @params=#{@params.inspect} @response=#{@response.inspect}>) end
def loaded?
-
(Boolean)
-
def loaded? @loaded end
def main?
-
(Boolean)
-
def main? @page.network.response == self end
def redirect?
-
(Boolean)
-
def redirect? params.key?("redirectResponse") end
def status
-
(Integer)
-
def status @response["status"] end
def status_text
-
(String)
-
def status_text @response["statusText"] end
def type
-
(String)
-
def type @params["type"] end
def url
-
(String)
-
def url @response["url"] end