pub fn add_content_type(&mut self, file: String) {
        let file_ending = Path::new(&file).extension().and_then(OsStr::to_str).unwrap();
        let content_type = match file_ending {
            "json" => "text/json",
            "js" => "application/javascript",
            "png"=> "img/png",
            "jpeg"=> "img/jpeg",
            "html"=> "text/html",
            "txt" => "text/plain",
            "css" => "text/css",
            _ => "text/plain",
        };
        self.add_header("content-type",content_type);
    }
/// Adds the content type into the response
Adds the content type into the response
Adds the content type into the response
pub fn add_content_type(&mut self, file: String) {
        let file_ending = Path::new(&file).extension().and_then(OsStr::to_str).unwrap();
        let content_type = match file_ending {
            "json" => "text/json",
            "js" => "application/javascript",
            "png"=> "img/png",
            "jpeg"=> "img/jpeg",
            "html"=> "text/html",
            "txt" => "text/plain",
            "css" => "text/css",
            _ => "text/plain",
        };
        self.add_header("content-type",content_type);
    }
pub fn add_content_type ( & mut self , file : String ) { let file_ending = Path :: new ( & file ) . extension ( ) . and_then ( OsStr :: to_str ) . unwrap ( ) ; let content_type = match file_ending { " " => " " , " " => " " , " " => " " , " " => " " , " " => " " , " " => " " , " " => " " , _ => " " , } ; self . add_header ( " " , content_type ) ; }
Adds the content type into the response
Adds the content type into the response
&mut self
file
String
&mut self
file
String