pub fn prefers_html(req: &Request) -> boolExpand description
Does this request come from something that would rather have a page than a document?
Only an explicit text/html in Accept counts: a client that sends none, or */*,
gets the JSON index, which is what every existing caller does.
use majordomus_cli::http::{router::prefers_html, Request};
let plain = Request::parse_target("GET", "/", vec![]);
assert!(!prefers_html(&plain));
let browser = plain.clone().with_headers(vec![
("Accept".into(), "text/html,application/xhtml+xml,*/*;q=0.8".into()),
]);
assert!(prefers_html(&browser));