Class: Selenium::WebDriver::BiDi::InterceptedResponse

Inherits:
InterceptedItem show all
Defined in:
lib/selenium/webdriver/bidi/network/intercepted_response.rb

Instance Attribute Summary collapse

Attributes inherited from InterceptedItem

#network, #request

Instance Method Summary collapse

Methods inherited from InterceptedItem

#id

Constructor Details

#initialize(network, request) ⇒ InterceptedResponse

Returns a new instance of InterceptedResponse.



31
32
33
34
35
36
37
38
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 31

def initialize(network, request)
  super
  @reason = nil
  @status = nil
  @body = nil
  @headers = nil
  @cookies = nil
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



29
30
31
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 29

def body
  @body
end

#reasonObject

Returns the value of attribute reason.



28
29
30
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 28

def reason
  @reason
end

#statusObject

Returns the value of attribute status.



28
29
30
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 28

def status
  @status
end

Instance Method Details

#continueObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 40

def continue
  cookies = @cookies&.as_json
  headers = @headers&.as_json
  network.continue_response(
    id: id,
    cookies: cookies,
    headers: headers,
    credentials: credentials.as_json,
    reason: reason,
    status: status
  )
end

#cookies(cookies = {}) ⇒ Object



78
79
80
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 78

def cookies(cookies = {})
  @cookies ||= Cookies.new(cookies)
end

#cookies=(cookies = {}) ⇒ Object



82
83
84
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 82

def cookies=(cookies = {})
  @cookies ||= Cookies.new(cookies)
end

#credentials(username: nil, password: nil) ⇒ Object



66
67
68
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 66

def credentials(username: nil, password: nil)
  @credentials ||= Credentials.new(username: username, password: password)
end

#headers(headers = {}) ⇒ Object



70
71
72
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 70

def headers(headers = {})
  @headers ||= Headers.new(headers)
end

#headers=(*headers) ⇒ Object



74
75
76
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 74

def headers=(*headers)
  @headers = Headers.new(headers)
end

#provide_responseObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/selenium/webdriver/bidi/network/intercepted_response.rb', line 53

def provide_response
  cookies = @cookies&.as_json
  headers = @headers&.as_json
  network.provide_response(
    id: id,
    cookies: cookies,
    headers: headers,
    body: body,
    reason: reason,
    status: status
  )
end