Class: Selenium::DevTools::V85::Fetch
- Inherits:
-
Object
- Object
- Selenium::DevTools::V85::Fetch
- Defined in:
- lib/selenium/devtools/v85/fetch.rb
Constant Summary collapse
- EVENTS =
{ request_paused: 'requestPaused', auth_required: 'authRequired', }.freeze
Instance Method Summary collapse
- #continue_request(request_id:, url: nil, method: nil, post_data: nil, headers: nil) ⇒ Object
- #continue_with_auth(request_id:, auth_challenge_response:) ⇒ Object
- #disable ⇒ Object
- #enable(patterns: nil, handle_auth_requests: nil) ⇒ Object
- #fail_request(request_id:, error_reason:) ⇒ Object
- #fulfill_request(request_id:, response_code:, response_headers: nil, binary_response_headers: nil, body: nil, response_phrase: nil) ⇒ Object
- #get_response_body(request_id:) ⇒ Object
-
#initialize(devtools) ⇒ Fetch
constructor
A new instance of Fetch.
- #on(event, &block) ⇒ Object
- #take_response_body_as_stream(request_id:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Fetch
Returns a new instance of Fetch.
30 31 32 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 30 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#continue_request(request_id:, url: nil, method: nil, post_data: nil, headers: nil) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 65 def continue_request(request_id:, url: nil, method: nil, post_data: nil, headers: nil) @devtools.send_cmd('Fetch.continueRequest', requestId: request_id, url: url, method: method, postData: post_data, headers: headers) end |
#continue_with_auth(request_id:, auth_challenge_response:) ⇒ Object
74 75 76 77 78 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 74 def continue_with_auth(request_id:, auth_challenge_response:) @devtools.send_cmd('Fetch.continueWithAuth', requestId: request_id, authChallengeResponse: auth_challenge_response) end |
#disable ⇒ Object
39 40 41 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 39 def disable @devtools.send_cmd('Fetch.disable') end |
#enable(patterns: nil, handle_auth_requests: nil) ⇒ Object
43 44 45 46 47 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 43 def enable(patterns: nil, handle_auth_requests: nil) @devtools.send_cmd('Fetch.enable', patterns: patterns, handleAuthRequests: handle_auth_requests) end |
#fail_request(request_id:, error_reason:) ⇒ Object
49 50 51 52 53 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 49 def fail_request(request_id:, error_reason:) @devtools.send_cmd('Fetch.failRequest', requestId: request_id, errorReason: error_reason) end |
#fulfill_request(request_id:, response_code:, response_headers: nil, binary_response_headers: nil, body: nil, response_phrase: nil) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 55 def fulfill_request(request_id:, response_code:, response_headers: nil, binary_response_headers: nil, body: nil, response_phrase: nil) @devtools.send_cmd('Fetch.fulfillRequest', requestId: request_id, responseCode: response_code, responseHeaders: response_headers, binaryResponseHeaders: binary_response_headers, body: body, responsePhrase: response_phrase) end |
#get_response_body(request_id:) ⇒ Object
80 81 82 83 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 80 def get_response_body(request_id:) @devtools.send_cmd('Fetch.getResponseBody', requestId: request_id) end |
#on(event, &block) ⇒ Object
34 35 36 37 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 34 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Fetch.#{event}"] << block end |
#take_response_body_as_stream(request_id:) ⇒ Object
85 86 87 88 |
# File 'lib/selenium/devtools/v85/fetch.rb', line 85 def take_response_body_as_stream(request_id:) @devtools.send_cmd('Fetch.takeResponseBodyAsStream', requestId: request_id) end |