about summary refs log tree commit diff stats
path: root/src/io/loader.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-02-09 15:56:29 +0100
committerbptato <nincsnevem662@gmail.com>2022-02-09 15:57:45 +0100
commit2edbb7b07d1b82e18e1dbe5eb58a3fcce659f783 (patch)
treed75e4c249ed6c9491c59165fd06555f68c5b428e /src/io/loader.nim
parentacfa008840bbd9fcdafcee4197a3a776db2d348d (diff)
downloadchawan-2edbb7b07d1b82e18e1dbe5eb58a3fcce659f783.tar.gz
Some loader polishing
Diffstat (limited to 'src/io/loader.nim')
-rw-r--r--src/io/loader.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/io/loader.nim b/src/io/loader.nim
index 4a10d336..d0181262 100644
--- a/src/io/loader.nim
+++ b/src/io/loader.nim
@@ -16,7 +16,7 @@ type
 
 const DefaultHeaders = {
   "User-Agent": "chawan",
-  "Accept": "text/html", "text/*;q=0.5",
+  "Accept": "text/html,text/*;q=0.5",
   "Accept-Language": "en;q=1.0",
   "Pragma": "no-cache",
   "Cache-control": "no-cache",
@@ -35,7 +35,9 @@ proc getPage*(loader: FileLoader, url: Url, smethod: HttpMethod = HttpGet, mimet
     result.contenttype = guessContentType(path)
     result.s = newFileStream(path, fmRead)
   elif url.scheme == "http" or url.scheme == "https":
-    var requestheaders = newHttpHeaders(DefaultHeaders, true)
+    var requestheaders = newHttpHeaders(true)
+    for header in DefaultHeaders:
+      requestheaders[header[0]] = header[1]
     if mimetype != "":
       requestheaders["Content-Type"] = mimetype 
     let resp = loader.http.request(url.serialize(true), smethod, body, requestheaders, multipart)