about summary refs log tree commit diff stats
path: root/src/loader/response.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/response.nim')
-rw-r--r--src/loader/response.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/loader/response.nim b/src/loader/response.nim
index 2f624a1a..ab74571e 100644
--- a/src/loader/response.nim
+++ b/src/loader/response.nim
@@ -101,13 +101,14 @@ func getCharset*(this: Response; fallback: Charset): Charset =
     return fallback
   return cs
 
-func getContentType*(this: Response): string =
+func getContentType*(this: Response; fallback = "application/octet-stream"):
+    string =
   if "Content-Type" in this.headers.table:
     let header = this.headers.table["Content-Type"][0].toLowerAscii()
     return header.until(';').strip()
   # also use DefaultGuess for container, so that local mime.types cannot
   # override buffer mime.types
-  return DefaultGuess.guessContentType(this.url.pathname)
+  return DefaultGuess.guessContentType(this.url.pathname, fallback)
 
 type TextOpaque = ref object of RootObj
   buf: string