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/loader.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/loader.nim')
-rw-r--r-- | src/loader/loader.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/loader/loader.nim b/src/loader/loader.nim index 6ab3ee9b..6cd17f44 100644 --- a/src/loader/loader.nim +++ b/src/loader/loader.nim @@ -312,10 +312,10 @@ proc applyHeaders(loader: FileLoader, request: Request, response: Response) = # it breaks mailcap named attributes other than charset.) # Ideally, contentType would be a separate object type. let header = response.headers.table["Content-Type"][0].toLowerAscii() - response.contenttype = header.until(';').strip().toLowerAscii() + response.contentType = header.until(';').strip().toLowerAscii() response.charset = getCharset(header.getAttribute("charset")) else: - response.contenttype = guessContentType($response.url.path, + response.contentType = guessContentType($response.url.path, "application/octet-stream", DefaultGuess) if "Location" in response.headers.table: if response.status in 301u16..303u16 or response.status in 307u16..308u16: |