From ac3e737867245ac65adfa2352ce6e7fdacc57b18 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 27 Sep 2023 02:48:21 +0200 Subject: buffer: simplify contentType handling * remove contentType member of Buffer object * add ishtml to reduce string comparisons * consistent spelling: contenttype -> contentType --- src/loader/response.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/loader/response.nim') 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]] -- cgit 1.4.1-2-gfad0