class Capybara::Apparition::NetworkTraffic::Request

Attributes

blocked_params[W]
response[R]
response_parts[R]

Public Class Methods

new(data, response_parts = []) click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 8
def initialize(data, response_parts = [])
  @data           = data
  @response_parts = response_parts
  @response = nil
  @blocked_params = nil
end

Public Instance Methods

blocked?() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 39
def blocked?
  !@blocked_params.nil?
end
error() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 43
def error
  response_parts.last&.error
end
headers() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 31
def headers
  @data[:request]&.dig('headers')
end
method() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 27
def method
  @data[:request]&.dig('method')
end
request_id() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 19
def request_id
  @data[:request_id]
end
response=(response) click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 15
def response=(response)
  @response_parts.push response
end
time() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 35
def time
  @data[:timestamp] && Time.parse(@data[:timestamp])
end
url() click to toggle source
# File lib/capybara/apparition/network_traffic/request.rb, line 23
def url
  @data[:request]&.dig('url')
end