Page
Library
Module
Module type
Parameter
Class
Class type
Source
Rock.Body
SourceRepresents an HTTP request or response body.
type content = [
| `Empty
| `String of string
| `Bigstring of Bigstringaf.t
| `Stream of string Lwt_stream.t
]
of_bigstring
creates a fixed length body from a bigstring.
of_stream
takes a string Lwt_stream.t
and creates a HTTP body from it.
copy t
creates a new instance of the body t
. If the body is a stream, it is be duplicated safely and the initial stream will remain untouched.
to_string t
returns a promise that will eventually be filled with a string representation of the body.
to_stream t
converts the body to a string Lwt_stream.t
.
drain t
will repeatedly read values from the body stream and discard them.
sexp_of_t t
converts the body t
to an s-expression
pp
formats the body t
as an s-expression
pp_hum
formats the body t
as an string.
If the body content is a stream, the pretty printer will output the value "<stream>"