package yurt

  1. Overview
  2. Docs

The Body module contains methods needed for creating, reading and modifying request data

type transfer_encoding = Cohttp.Transfer.encoding
val to_string : t -> string Lwt.t

Convert body to string

val to_stream : t -> string Lwt_stream.t

Convert body to stream

val to_json : t -> Ezjsonm.t Lwt.t

Convert body to JSON

val of_string : string -> t

Create body from string

val of_stream : string Lwt_stream.t -> t

Create body from stream

val of_json : Ezjsonm.t -> t

Create body from JSON

val map : (string -> string) -> t -> t

Modify body

val length : t -> (int64 * t) Lwt.t

Get body length

val is_empty : t -> bool Lwt.t

Returns true when body has no content

val drain : t -> unit Lwt.t

Ignore body content

val transfer_encoding : t -> transfer_encoding