Skip to main content

media_type

Function media_type 

Source
pub fn media_type(name: &str) -> Option<&'static str>
Expand description

The media type of a file name, when it is one a static surface serves.

use majordomus_cli::web::files::media_type;
assert_eq!(media_type("index.html"), Some("text/html; charset=utf-8"));
assert_eq!(media_type("logo.png"), Some("image/png"));
assert_eq!(media_type("secrets.env"), None);
assert_eq!(media_type("Makefile"), None);