Module Http.Mime_type

A few ubiquitous MIME types.

See also Webs_kit.Mime_type.

MIME types

type t = mime_type
val application_json : mime_type

application_json is "application/json", JSON text.

val application_octet_stream : mime_type

application_octet_stream is "application/octet-stream", arbitrary bytes.

val application_x_www_form_urlencoded : mime_type

application_x_www_form_urlencoded is "application/x-www-form-urlencoded".

val text_css : mime_type

text_css is "text/css", a CSS stylesheet.

val text_html : mime_type

text_html is "text/html; charset=utf-8", UTF-8 encoded HTML text.

val text_javascript : mime_type

text_jvascript is "text/javascript", JavaScript code.

val text_plain : mime_type

text_plain is "text/plain; charset=utf-8", UTF-8 encoded plain text.

val multipart_byteranges : mime_type

multipart_byteranges is "multipart/byteranges".

val multipart_form_data : mime_type

multipart_form_data is "multipart/form-data".

From file extensions

type file_ext = string

The type for file extensions, including the . character.

type file_ext_map = t Stdlib.Map.Make(Stdlib.String).t

The type for maps from file extensions to MIME types.

val default_file_ext_map : file_ext_map Stdlib.Lazy.t

default_file_ext_map is a default extension map. The map is documented by its implementation. Non self-describing text/* MIME types have the parameter charset=utf-8.

val of_file_ext : ?map:file_ext_map -> file_ext -> t

of_file_ext ~map ext is the value of ext in map or "application/octet-stream" if ext is unbound in map. map defaults to default_file_ext_map.

val of_filepath : ?map:file_ext_map -> fpath -> t

of_filepath ~map f is of_file_ext ~map (Http.filepath_ext f).