Types
module Map : Stdlib.Map.S with type key = string
An ocaml Stdlib
Map with string
as key.
module Part : sig ... end
Represents a parsed multipart part. A part corresponds to a submitted form field data in a HTTP request.
Represents a parsed HTTP multipart/form-data
request as a key/value
map. Submitted form field name is the key value.
A key may be associated in zero or more values.
exception Multipart of string
Represents error while parsing http multipart formdata.
Parse
val parse : content_type_header:string -> body:string -> t
parse ~content_type_header ~body
returns a parsed HTTP multiparts such that it can be queried using ocaml Stdlib.Map
functions.
content_type_header
is the HTTP request Content-Type
header. Note the value contains both the header name and value. It is used to parse a boundary
value.
body
is the raw HTTP POST request body content.
Examples
module M = Http_multipart_formdata
;;
let content_type_header =
@@ -48,4 +48,4 @@
}
]
in
-M.equal_parts file1_1 file1_2
- raises Multipart
val pp_parts : Stdlib.Format.formatter -> Part.t list -> unit
pp_parts fmt parts
pretty prints a list of Part.t
val pp : Stdlib.Format.formatter -> t -> unit
pp fmt part
pretty prints a part
.
val equal_parts : Part.t list -> Part.t list -> bool
equal_parts parts1 parts2
returns true
if parts1
and parts2
are equal, false
otherwise.
val equal : t -> t -> bool
equal t1 t2
returns true
if Part.
t1
and t2
are equal, false
otherwise.
\ No newline at end of file
+M.equal_parts file1_1 file1_2