Function goose_eggs::validate_and_load_static_assets [−][src]
pub async fn validate_and_load_static_assets<'a>(
user: &GooseUser,
goose: GooseResponse,
validate: Option<&'a Validate<'a>>
) -> GooseTaskResult
Expand description
Validate the HTML response then extract and load all static elements on the page.
What is validated is defined with the Validate
structure.
Example
use goose::prelude::*; use goose_eggs::{validate_and_load_static_assets, Validate}; task!(load_page).set_on_start(); async fn load_page(user: &GooseUser) -> GooseTaskResult { let mut goose = user.get("/").await?; validate_and_load_static_assets( user, goose, Some(&Validate { // Don't do any extra validation of the status code. status: None, // Be sure the expected title is on the page. title: Some("my page"), // Be sure both of the following strings are found on the page. texts: vec!["foo", r#"<a href="bar">"#], }), ).await?; Ok(()) }