From e337f787404129583c1b0c8e22b1babd20e75638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= <24468819+Yagich@users.noreply.github.com> Date: Sat, 25 Jun 2022 17:37:26 +0300 Subject: [PATCH] remove redundant get_mime_type() function --- Main.gd | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Main.gd b/Main.gd index a3148a6..6b60a2d 100644 --- a/Main.gd +++ b/Main.gd @@ -67,18 +67,13 @@ func _serve_file(_request: HTTPServer.Request, response: HTTPServer.Response, bi var mime := mime_types.get(file_name) response.header("content-type", mime.full_type) - + # variant # warning-ignore:incompatible_ternary var data = f.get_as_text() if mime.type == 'text' else f.get_buffer(f.get_len()) response.data(data) - + else: response.header("content-type", "text/plain") response.data("500 - Read Error") - - -func get_mime_type(file_name: String) -> String: - var ext := file_name.get_extension().to_lower() - return mime_types[ext] if ext in mime_types else "application/octet-stream"