pub struct NetworkManager {
pub request_timeout: Duration,
pub ignore_visuals: bool,
pub block_stylesheets: bool,
pub block_javascript: bool,
pub block_analytics: bool,
pub only_html: bool,
pub xml_document: bool,
pub intercept_manager: NetworkInterceptManager,
pub document_reload_tracker: u8,
pub document_target_domain: String,
pub max_bytes_allowed: Option<u64>,
/* private fields */
}Expand description
The base network manager.
Fields§
§request_timeout: DurationThe page request timeout.
ignore_visuals: boolIgnore visuals (no pings, prefetching, and etc).
block_stylesheets: boolBlock CSS stylesheets.
block_javascript: boolBlock javascript that is not critical to rendering.
block_analytics: boolBlock analytics from rendering
only_html: boolOnly html from loading.
xml_document: boolIs xml document?
intercept_manager: NetworkInterceptManagerThe custom intercept handle logic to run on the website.
document_reload_tracker: u8Track the amount of times the document reloaded.
document_target_domain: StringThe initial target domain. We want to use a new page on every navigation to prevent re-using the old domain.
max_bytes_allowed: Option<u64>The max bytes to receive.
Implementations§
Source§impl NetworkManager
impl NetworkManager
pub fn new(ignore_httpserrors: bool, request_timeout: Duration) -> Self
pub fn init_commands(&self) -> CommandChain
Sourcepub fn poll(&mut self) -> Option<NetworkEvent>
pub fn poll(&mut self) -> Option<NetworkEvent>
The next event to handle
pub fn extra_headers(&self) -> &HashMap<String, String>
pub fn set_extra_headers(&mut self, headers: HashMap<String, String>)
pub fn set_service_worker_enabled(&mut self, bypass: bool)
pub fn set_block_all(&mut self, block_all: bool)
pub fn set_request_interception(&mut self, enabled: bool)
pub fn set_cache_enabled(&mut self, enabled: bool)
pub fn disable_request_intercept(&mut self)
pub fn update_protocol_cache_disabled(&mut self)
pub fn authenticate(&mut self, credentials: Credentials)
Sourcepub fn on_fetch_request_paused(&mut self, event: &EventRequestPaused)
pub fn on_fetch_request_paused(&mut self, event: &EventRequestPaused)
On fetch requesdt paused interception.
Sourcepub fn has_target_domain(&self) -> bool
pub fn has_target_domain(&self) -> bool
Does the network manager have a target domain?
Sourcepub fn set_page_url(&mut self, page_target_url: String)
pub fn set_page_url(&mut self, page_target_url: String)
Set the target page url for tracking.
Sourcepub fn clear_target_domain(&mut self)
pub fn clear_target_domain(&mut self)
Clear the initial target domain on every navigation.
pub fn on_fetch_auth_required(&mut self, event: &EventAuthRequired)
pub fn set_offline_mode(&mut self, value: bool)
Sourcepub fn on_request_will_be_sent(&mut self, event: &EventRequestWillBeSent)
pub fn on_request_will_be_sent(&mut self, event: &EventRequestWillBeSent)
Request interception doesn’t happen for data URLs with Network Service.
Sourcepub fn on_request_served_from_cache(
&mut self,
event: &EventRequestServedFromCache,
)
pub fn on_request_served_from_cache( &mut self, event: &EventRequestServedFromCache, )
The request was served from the cache.
Sourcepub fn on_response_received(&mut self, event: &EventResponseReceived)
pub fn on_response_received(&mut self, event: &EventResponseReceived)
On network response received.