package cohttp

  1. Overview
  2. Docs

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 -> Ppx_sexp_conv_lib.Sexp.t
val t_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> t
val __t_of_sexp__ : Ppx_sexp_conv_lib.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 empty : t
val is_empty : t -> bool
val of_string : string -> t
val of_string_list : string list -> t
val map : (string -> string) -> t -> t
val transfer_encoding : t -> Transfer.encoding
val length : t -> int64
OCaml

Innovation. Community. Security.