summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gemini/mimeType.ml6
-rw-r--r--gemini/mimeType.mli2
2 files changed, 8 insertions, 0 deletions
diff --git a/gemini/mimeType.ml b/gemini/mimeType.ml
index 0cfd063..16abcab 100644
--- a/gemini/mimeType.ml
+++ b/gemini/mimeType.ml
@@ -11,6 +11,8 @@ sig
val to_subtype : t -> string
val to_parameter : t -> (string * string) option
+
+ val to_canonical : t -> string
end
module MimeType : MIME_TYPE =
@@ -62,4 +64,8 @@ struct
let to_parameter m = m.mime_param
+ let to_canonical m =
+ match to_parameter m with
+ | Some (p, v) -> (to_type m) ^ "/" ^ (to_subtype m) ^ " " ^ p ^ "=" ^ v
+ | None -> (to_type m) ^ "/" ^ (to_subtype m)
end
diff --git a/gemini/mimeType.mli b/gemini/mimeType.mli
index 6075ef9..c8b2959 100644
--- a/gemini/mimeType.mli
+++ b/gemini/mimeType.mli
@@ -11,6 +11,8 @@ sig
val to_subtype : t -> string
val to_parameter : t -> (string * string) option
+
+ val to_canonical : t -> string
end
module MimeType : MIME_TYPE