about summary refs log tree commit diff stats
path: root/src/io/response.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/io/response.nim')
-rw-r--r--src/io/response.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/io/response.nim b/src/io/response.nim
index 75e3d664..6d4db42f 100644
--- a/src/io/response.nim
+++ b/src/io/response.nim
@@ -53,20 +53,19 @@ proc close*(response: Response) {.jsfunc.} =
 
 proc text*(response: Response): Promise[JSResult[string]] {.jsfunc.} =
   if response.bodyRead == nil:
-    let p = newPromise[Result[string, JSError]]()
-    let err = Result[string, JSError]
+    let p = newPromise[JSResult[string]]()
+    let err = JSResult[string]
       .err(newTypeError("Body has already been consumed"))
     p.resolve(err)
     return p
   let bodyRead = response.bodyRead
   response.bodyRead = nil
-  return bodyRead.then(proc(s: string): Result[string, JSError] =
+  return bodyRead.then(proc(s: string): JSResult[string] =
     ok(s))
 
 proc json(ctx: JSContext, this: Response): Promise[JSResult[JSValue]]
     {.jsfunc.} =
-  return this.text().then(proc(s: Result[string, JSError]):
-      Result[JSValue, JSError] =
+  return this.text().then(proc(s: JSResult[string]): JSResult[JSValue] =
     let s = ?s
     return ok(JS_ParseJSON(ctx, cstring(s), cast[csize_t](s.len),
       cstring"<input>")))