Module Cohttp.Body

HTTP request and response body handling

type t = [
  1. | `Empty
  2. | `String of string
  3. | `Strings of string list
]

Every HTTP body can at least be an empty value or a string

val sexp_of_t : t -> Sexplib0.Sexp.t
val t_of_sexp : Sexplib0.Sexp.t -> t
val __t_of_sexp__ : Sexplib0.Sexp.t -> t

Signature for the core of HTTP body handling. Implementations will extend this signature to add more functions for streaming responses via backend-specific functionality.

include S.Body with type t := t
val to_string : t -> string
val to_string_list : t -> string list
val to_form : t -> (string * string list) list
val empty : t
val is_empty : t -> bool
val of_string : string -> t
val of_string_list : string list -> t
val of_form : ?scheme:string -> (string * string list) list -> t
val map : (string -> string) -> t -> t
val transfer_encoding : t -> Transfer.encoding
val length : t -> int64