Skip to main content

page_for

Function page_for 

Source
pub fn page_for(checkout: &str) -> String
Expand description

The page as one server serves it: the shell, with the line naming the checkout that is serving it where CHECKOUT_MARKER stands. checkout is HTML the caller has escaped — the router renders it from the repository model (crate::web::home::Checkout::line), which names the checkout by its identity and never by where it sits on the host.

use majordomus_cli::http::swagger;
let page = swagger::page_for("<p class=\"mj-checkout\">checkout 0123456789ab</p>");
assert!(page.contains("checkout 0123456789ab"));
assert!(!page.contains(swagger::CHECKOUT_MARKER), "the marker is replaced, not kept");
assert_eq!(page.len() - swagger::page().len() + swagger::CHECKOUT_MARKER.len(),
    "<p class=\"mj-checkout\">checkout 0123456789ab</p>".len(), "nothing else changes");