Class: Ferrum::Network::InterceptedRequest
- Inherits:
-
Object
- Object
- Ferrum::Network::InterceptedRequest
- Defined in:
- lib/ferrum/network/intercepted_request.rb
Instance Attribute Summary collapse
-
#frame_id ⇒ Object
Returns the value of attribute frame_id.
-
#interception_id ⇒ Object
Returns the value of attribute interception_id.
-
#is_navigation_request ⇒ Object
Returns the value of attribute is_navigation_request.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
Instance Method Summary collapse
- #abort ⇒ Object
- #auth_challenge?(source) ⇒ Boolean
- #continue(**options) ⇒ Object
- #headers ⇒ Object
- #initial_priority ⇒ Object
-
#initialize(page, params) ⇒ InterceptedRequest
constructor
A new instance of InterceptedRequest.
- #match?(regexp) ⇒ Boolean
- #method ⇒ Object
- #referrer_policy ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(page, params) ⇒ InterceptedRequest
Returns a new instance of InterceptedRequest.
8 9 10 11 12 13 14 15 |
# File 'lib/ferrum/network/intercepted_request.rb', line 8 def initialize(page, params) @page, @params = page, params @interception_id = params["interceptionId"] @frame_id = params["frameId"] @resource_type = params["resourceType"] @is_navigation_request = params["isNavigationRequest"] @request = params.dig("request") end |
Instance Attribute Details
#frame_id ⇒ Object
Returns the value of attribute frame_id.
5 6 7 |
# File 'lib/ferrum/network/intercepted_request.rb', line 5 def frame_id @frame_id end |
#interception_id ⇒ Object
Returns the value of attribute interception_id.
5 6 7 |
# File 'lib/ferrum/network/intercepted_request.rb', line 5 def interception_id @interception_id end |
#is_navigation_request ⇒ Object
Returns the value of attribute is_navigation_request.
5 6 7 |
# File 'lib/ferrum/network/intercepted_request.rb', line 5 def @is_navigation_request end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
5 6 7 |
# File 'lib/ferrum/network/intercepted_request.rb', line 5 def resource_type @resource_type end |
Instance Method Details
#abort ⇒ Object
25 26 27 |
# File 'lib/ferrum/network/intercepted_request.rb', line 25 def abort @page.abort_request(interception_id) end |
#auth_challenge?(source) ⇒ Boolean
17 18 19 |
# File 'lib/ferrum/network/intercepted_request.rb', line 17 def auth_challenge?(source) @params.dig("authChallenge", "source")&.downcase&.to_s == source.to_s end |
#continue(**options) ⇒ Object
29 30 31 |
# File 'lib/ferrum/network/intercepted_request.rb', line 29 def continue(**) @page.continue_request(interception_id, **) end |
#headers ⇒ Object
41 42 43 |
# File 'lib/ferrum/network/intercepted_request.rb', line 41 def headers @request["headers"] end |
#initial_priority ⇒ Object
45 46 47 |
# File 'lib/ferrum/network/intercepted_request.rb', line 45 def initial_priority @request["initialPriority"] end |
#match?(regexp) ⇒ Boolean
21 22 23 |
# File 'lib/ferrum/network/intercepted_request.rb', line 21 def match?(regexp) !!url.match(regexp) end |
#method ⇒ Object
37 38 39 |
# File 'lib/ferrum/network/intercepted_request.rb', line 37 def method @request["method"] end |
#referrer_policy ⇒ Object
49 50 51 |
# File 'lib/ferrum/network/intercepted_request.rb', line 49 def referrer_policy @request["referrerPolicy"] end |
#url ⇒ Object
33 34 35 |
# File 'lib/ferrum/network/intercepted_request.rb', line 33 def url @request["url"] end |