Body.PrivateInternal functions exposed for use by other modules in the library. These are not part of the public API and may change between versions.
val to_flow_source :
sw:Eio.Switch.t ->
t ->
Eio.Flow.source_ty Eio.Resource.t optionto_flow_source ~sw body converts the body to an Eio flow source. Uses the switch to manage resources like file handles. This function is used internally by the Client module.
val to_string : t -> stringto_string body converts the body to a string for HTTP/1.1 requests. Only works for materialized bodies (String type). Raises Failure for streaming/file/multipart bodies.
val is_empty : t -> boolis_empty body returns true if the body is empty.
val is_chunked : t -> boolis_chunked body returns true if the body should use chunked transfer encoding (i.e., it's a stream without known length or a multipart body).
val write : sw:Eio.Switch.t -> Eio.Buf_write.t -> t -> unitwrite ~sw w body writes the body content to the buffer writer. Uses the switch to manage resources like file handles.
val write_chunked : sw:Eio.Switch.t -> Eio.Buf_write.t -> t -> unitwrite_chunked ~sw w body writes the body content using HTTP chunked transfer encoding. Each chunk is prefixed with its hex size.