Skip to content

Commit c497411

Browse files
committed
fix(cli): detect jsonc and json5 mime types
1 parent 7954d02 commit c497411

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/cortex-cli/src/run_cmd/mime.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn mime_type_from_extension(path: &Path) -> String {
2222
// Code files
2323
"js" | "mjs" | "cjs" => "text/javascript",
2424
"ts" | "tsx" => "text/typescript",
25-
"json" => "application/json",
25+
"json" | "jsonc" | "json5" => "application/json",
2626
"rs" => "text/x-rust",
2727
"py" => "text/x-python",
2828
"rb" => "text/x-ruby",
@@ -75,6 +75,14 @@ mod tests {
7575
mime_type_from_extension(&PathBuf::from("test.json")),
7676
"application/json"
7777
);
78+
assert_eq!(
79+
mime_type_from_extension(&PathBuf::from("test.jsonc")),
80+
"application/json"
81+
);
82+
assert_eq!(
83+
mime_type_from_extension(&PathBuf::from("test.json5")),
84+
"application/json"
85+
);
7886
assert_eq!(
7987
mime_type_from_extension(&PathBuf::from("test.png")),
8088
"image/png"

0 commit comments

Comments
 (0)