Function goose_eggs::validate_and_load_static_assets[][src]

pub async fn validate_and_load_static_assets<'a>(
    user: &GooseUser,
    goose: GooseResponse,
    validate: &'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,
        // Validate title and other arbitrary text on the response html.
        &Validate::title_texts("my page", vec!["foo", r#"<a href="bar">"#]),
    ).await?;

    Ok(())
}