pub struct Request { /* private fields */ }Expand description
Request represents an HTTP request during navigation.
Request objects are created by the server during navigation operations. They are parents to Response objects.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(
parent: Arc<dyn ChannelOwner>,
type_name: String,
guid: Arc<str>,
initializer: Value,
) -> Result<Self>
pub fn new( parent: Arc<dyn ChannelOwner>, type_name: String, guid: Arc<str>, initializer: Value, ) -> Result<Self>
Creates a new Request from protocol initialization
This is called by the object factory when the server sends a __create__ message
for a Request object.
Sourcepub fn url(&self) -> &str
pub fn url(&self) -> &str
Returns the URL of the request.
See: https://playwright.dev/docs/api/class-request#request-url
Sourcepub fn method(&self) -> &str
pub fn method(&self) -> &str
Returns the HTTP method of the request (GET, POST, etc.).
See: https://playwright.dev/docs/api/class-request#request-method
Sourcepub fn resource_type(&self) -> &str
pub fn resource_type(&self) -> &str
Returns the resource type of the request (e.g., “document”, “stylesheet”, “image”, “fetch”, etc.).
See: https://playwright.dev/docs/api/class-request#request-resource-type
Check if this request is for a navigation (main document).
A navigation request is when the request is for the main frame’s document. This is used to distinguish between main document loads and subresource loads.