rs-mock-server 0.6.2

A simple, file-based mock API server that maps your directory structure to HTTP routes. Ideal for local development and testing.
use std::{ffi::OsString, path::Path};

pub fn get_file_extension(file_path: &OsString) -> String {
    Path::new(file_path)
        .extension()
        .and_then(std::ffi::OsStr::to_str)
        .unwrap_or_default()
        .to_string()
}

pub fn is_text_file(file_path: &OsString) -> bool {
    let extension = get_file_extension(file_path);
    extension == "txt" || extension == "md" || extension == "json" || extension == "jgd"
}

pub fn is_jgd(file_path: &OsString) -> bool {
    let extension = get_file_extension(file_path);
    extension == "jgd"
}