X-Git-Url: http://nitlanguage.org diff --git a/lib/nitcorn/file_server.nit b/lib/nitcorn/file_server.nit index 63ab11a..0245d1f 100644 --- a/lib/nitcorn/file_server.nit +++ b/lib/nitcorn/file_server.nit @@ -65,6 +65,15 @@ class FileServer # Header of each directory page var header: nullable Writable = null is writable + # Custom JavaScript code added within a ` {{{title}}} @@ -142,29 +204,7 @@ class FileServer """ - response.header["Content-Type"] = media_types["html"].as(not null) - else - # It's a single file - response.files.add local_file - - var ext = local_file.file_extension - if ext != null then - var media_type = media_types[ext] - if media_type != null then - response.header["Content-Type"] = media_type - else response.header["Content-Type"] = "application/octet-stream" - end - end - - else response = new HttpResponse(404) - else response = new HttpResponse(403) - - if response.status_code != 200 then - var tmpl = error_page(response.status_code) - if header != null and tmpl isa ErrorTemplate then tmpl.header = header - response.body = tmpl.to_s - end - + response.header["Content-Type"] = media_types["html"].as(not null) return response end end