about summary refs log tree commit diff stats
path: root/src/loader
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-13 23:04:21 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-13 23:24:53 +0200
commitd90e456b80ee11a84eb2a29ce01794fa662eb7b9 (patch)
tree30d358ef3a5c50c6a0272a25f6aff9d150480c4a /src/loader
parent17bf0e843084712d9a914868ec44896f48d9d13a (diff)
downloadchawan-d90e456b80ee11a84eb2a29ce01794fa662eb7b9.tar.gz
Update Chame, Chagashi
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/response.nim6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/loader/response.nim b/src/loader/response.nim
index ca300957..8ea17e64 100644
--- a/src/loader/response.nim
+++ b/src/loader/response.nim
@@ -3,7 +3,6 @@ import std/tables
 
 import chagashi/charset
 import chagashi/decoder
-import chagashi/validator
 import io/promise
 import io/socketstream
 import loader/headers
@@ -120,10 +119,7 @@ proc text*(response: Response): Promise[JSResult[string]] {.jsfunc.} =
     let charset = response.getCharset(CHARSET_UTF_8)
     #TODO this is inefficient
     # maybe add a JS type that turns a seq[char] into JS strings
-    if charset == CHARSET_UTF_8:
-      ok(s.toValidUTF8())
-    else:
-      ok(newTextDecoder(charset).decodeAll(s))
+    ok(s.decodeAll(charset))
   )
 
 proc blob*(response: Response): Promise[JSResult[Blob]] {.jsfunc.} =