diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-27 02:48:21 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-27 02:51:41 +0200 |
commit | ac3e737867245ac65adfa2352ce6e7fdacc57b18 (patch) | |
tree | e747a5891176c7dce618bafaf79d750d5a40416f /src/loader/response.nim | |
parent | 285b6f32c28d1cda403ba33bfb2d22c34fab2a1e (diff) | |
download | chawan-ac3e737867245ac65adfa2352ce6e7fdacc57b18.tar.gz |
buffer: simplify contentType handling
* remove contentType member of Buffer object * add ishtml to reduce string comparisons * consistent spelling: contenttype -> contentType
Diffstat (limited to 'src/loader/response.nim')
-rw-r--r-- | src/loader/response.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/loader/response.nim b/src/loader/response.nim index 1133a5e4..8ad98f84 100644 --- a/src/loader/response.nim +++ b/src/loader/response.nim @@ -17,7 +17,7 @@ type fd*: int body*: Stream bodyUsed* {.jsget.}: bool - contenttype*: string + contentType*: string status* {.jsget.}: uint16 headers* {.jsget.}: Headers redirect*: Request @@ -75,11 +75,11 @@ proc blob(response: Response): Promise[JSResult[Blob]] {.jsfunc.} = response.bodyRead = nil return bodyRead.then(proc(s: string): JSResult[Blob] = if s.len == 0: - return ok(newBlob(nil, 0, response.contenttype, nil)) + return ok(newBlob(nil, 0, response.contentType, nil)) GC_ref(s) let deallocFun = proc() = GC_unref(s) - let blob = newBlob(unsafeAddr s[0], s.len, response.contenttype, deallocFun) + let blob = newBlob(unsafeAddr s[0], s.len, response.contentType, deallocFun) ok(blob)) proc json(ctx: JSContext, this: Response): Promise[JSResult[JSValue]] |