summaryrefslogtreecommitdiff
path: root/gemini/mimeType.ml
blob: 05591685b35623a181f5c383ba7480dd46b0a19c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module type MIME_TYPE =
sig
  type t

  exception ParseError of string

  val from_string : string -> t

  val to_type : t -> string

  val to_subtype : t -> string

  val to_parameter : t -> (string * string) option
end

module MimeType : MIME_TYPE =
struct

  type t =
    { mime_type : string;
      mime_subtype : string;
      mime_param : (string * string) option;
    }

  exception ParseError of string

  let from_string _ = { mime_type = "text";
                        mime_subtype = "plain";
                        mime_param = None }

  let to_type m = m.mime_type

  let to_subtype m = m.mime_subtype

  let to_parameter m = m.mime_param

end