Skip to main content

rustenium_cdp_definitions/browser_protocol/fetch/
events.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Issued when the domain is enabled and the request URL matches the\nspecified filter. The request is paused until the client responds\nwith one of continueRequest, failRequest or fulfillRequest.\nThe stage of the request can be determined by presence of responseErrorReason\nand responseStatusCode -- the request is at the response stage if either\nof these fields is present and in the request stage otherwise.\nRedirect responses and subsequent requests are reported similarly to regular\nresponses and requests. Redirect responses may be distinguished by the value\nof `responseStatusCode` (which is one of 301, 302, 303, 307, 308) along with\npresence of the `location` header. Requests resulting from a redirect will\nhave `redirectedRequestId` field set.\n[requestPaused](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct RequestPausedParams {
5    #[doc = "Each request the page makes will have a unique id."]
6    #[serde(rename = "requestId")]
7    pub request_id: super::types::RequestId,
8    #[doc = "The details of the request."]
9    #[serde(rename = "request")]
10    pub request: crate::browser_protocol::network::types::Request,
11    #[doc = "The id of the frame that initiated the request."]
12    #[serde(rename = "frameId")]
13    pub frame_id: crate::browser_protocol::page::types::FrameId,
14    #[doc = "How the requested resource will be used."]
15    #[serde(rename = "resourceType")]
16    pub resource_type: crate::browser_protocol::network::types::ResourceType,
17    #[doc = "Response error if intercepted at response stage."]
18    #[serde(rename = "responseErrorReason")]
19    #[serde(skip_serializing_if = "Option::is_none")]
20    #[serde(default)]
21    pub response_error_reason: Option<crate::browser_protocol::network::types::ErrorReason>,
22    #[doc = "Response code if intercepted at response stage."]
23    #[serde(rename = "responseStatusCode")]
24    #[serde(skip_serializing_if = "Option::is_none")]
25    #[serde(default)]
26    pub response_status_code: Option<i64>,
27    #[doc = "Response status text if intercepted at response stage."]
28    #[serde(rename = "responseStatusText")]
29    #[serde(skip_serializing_if = "Option::is_none")]
30    #[serde(default)]
31    pub response_status_text: Option<String>,
32    #[doc = "Response headers if intercepted at the response stage."]
33    #[serde(rename = "responseHeaders")]
34    #[serde(skip_serializing_if = "Option::is_none")]
35    #[serde(default)]
36    pub response_headers: Option<Vec<super::types::HeaderEntry>>,
37    #[doc = "If the intercepted request had a corresponding Network.requestWillBeSent event fired for it,\nthen this networkId will be the same as the requestId present in the requestWillBeSent event."]
38    #[serde(rename = "networkId")]
39    #[serde(skip_serializing_if = "Option::is_none")]
40    #[serde(default)]
41    pub network_id: Option<crate::browser_protocol::network::types::RequestId>,
42    #[doc = "If the request is due to a redirect response from the server, the id of the request that\nhas caused the redirect."]
43    #[serde(rename = "redirectedRequestId")]
44    #[serde(skip_serializing_if = "Option::is_none")]
45    #[serde(default)]
46    pub redirected_request_id: Option<super::types::RequestId>,
47}
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
49pub enum RequestPausedMethod {
50    #[serde(rename = "Fetch.requestPaused")]
51    RequestPaused,
52}
53#[doc = "Issued when the domain is enabled and the request URL matches the\nspecified filter. The request is paused until the client responds\nwith one of continueRequest, failRequest or fulfillRequest.\nThe stage of the request can be determined by presence of responseErrorReason\nand responseStatusCode -- the request is at the response stage if either\nof these fields is present and in the request stage otherwise.\nRedirect responses and subsequent requests are reported similarly to regular\nresponses and requests. Redirect responses may be distinguished by the value\nof `responseStatusCode` (which is one of 301, 302, 303, 307, 308) along with\npresence of the `location` header. Requests resulting from a redirect will\nhave `redirectedRequestId` field set.\n[requestPaused](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused)"]
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55pub struct RequestPaused {
56    pub method: RequestPausedMethod,
57    pub params: RequestPausedParams,
58}
59impl RequestPaused {
60    pub const IDENTIFIER: &'static str = "Fetch.requestPaused";
61    pub fn identifier(&self) -> &'static str {
62        Self::IDENTIFIER
63    }
64}
65#[doc = "Issued when the domain is enabled with handleAuthRequests set to true.\nThe request is paused until client responds with continueWithAuth.\n[authRequired](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-authRequired)"]
66#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
67pub struct AuthRequiredParams {
68    #[doc = "Each request the page makes will have a unique id."]
69    #[serde(rename = "requestId")]
70    pub request_id: super::types::RequestId,
71    #[doc = "The details of the request."]
72    #[serde(rename = "request")]
73    pub request: crate::browser_protocol::network::types::Request,
74    #[doc = "The id of the frame that initiated the request."]
75    #[serde(rename = "frameId")]
76    pub frame_id: crate::browser_protocol::page::types::FrameId,
77    #[doc = "How the requested resource will be used."]
78    #[serde(rename = "resourceType")]
79    pub resource_type: crate::browser_protocol::network::types::ResourceType,
80    #[doc = "Details of the Authorization Challenge encountered.\nIf this is set, client should respond with continueRequest that\ncontains AuthChallengeResponse."]
81    #[serde(rename = "authChallenge")]
82    pub auth_challenge: super::types::AuthChallenge,
83}
84#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
85pub enum AuthRequiredMethod {
86    #[serde(rename = "Fetch.authRequired")]
87    AuthRequired,
88}
89#[doc = "Issued when the domain is enabled with handleAuthRequests set to true.\nThe request is paused until client responds with continueWithAuth.\n[authRequired](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-authRequired)"]
90#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
91pub struct AuthRequired {
92    pub method: AuthRequiredMethod,
93    pub params: AuthRequiredParams,
94}
95impl AuthRequired {
96    pub const IDENTIFIER: &'static str = "Fetch.authRequired";
97    pub fn identifier(&self) -> &'static str {
98        Self::IDENTIFIER
99    }
100}
101group_enum ! (FetchEvents { RequestPaused (RequestPaused) , AuthRequired (AuthRequired) } + identifiable);