about summary refs log tree commit diff stats
path: root/src/types/mime.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/mime.nim')
-rw-r--r--src/types/mime.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/types/mime.nim b/src/types/mime.nim
index 2db567ad..cd4c2d51 100644
--- a/src/types/mime.nim
+++ b/src/types/mime.nim
@@ -12,12 +12,12 @@ const DefaultGuess = [
   ("", "text/plain")
 ].toTable()
 
-proc guessContentType*(path: string): string =
+proc guessContentType*(path: string, def = DefaultGuess[""]): string =
   var i = path.len - 1
   var n = 0
   while i > 0:
     if path[i] == '/':
-      return DefaultGuess[""]
+      return def
     if path[i] == '.':
       n = i
       break
@@ -26,7 +26,7 @@ proc guessContentType*(path: string): string =
     let ext = path.substr(n + 1)
     if ext in DefaultGuess:
       return DefaultGuess[ext]
-  return DefaultGuess[""]
+  return def
 
 const JavaScriptTypes = [
   "application/ecmascript",