tuned signature: more explicit operations;
authorwenzelm
Thu, 13 Feb 2025 14:10:50 +0100
changeset 82153 3c2451d482bd
parent 82152 3312ca0f3915
child 82154 1af962db8ca6
tuned signature: more explicit operations;
src/Pure/General/http.scala
--- a/src/Pure/General/http.scala	Wed Feb 12 23:17:08 2025 +0100
+++ b/src/Pure/General/http.scala	Thu Feb 13 14:10:50 2025 +0100
@@ -28,6 +28,9 @@
     val default_mime_type: String = mime_type_bytes
     val default_encoding: String = UTF8.charset.name
 
+    def file_mime_type(file: JFile): String =
+      Option(Files.probeContentType(file.toPath)).getOrElse(default_mime_type)
+
     def apply(
         bytes: Bytes,
         file_name: String = "",
@@ -39,7 +42,7 @@
     def read(file: JFile): Content = {
       val bytes = Bytes.read(file)
       val file_name = file.getName
-      val mime_type = Option(Files.probeContentType(file.toPath)).getOrElse(default_mime_type)
+      val mime_type = file_mime_type(file)
       apply(bytes, file_name = file_name, mime_type = mime_type)
     }