Body

zio.http.Body
See theBody companion object
trait Body

Represents the body of a request or response. The body can be a fixed chunk of bytes, a stream of bytes, or form data, or any type that can be encoded into such representations (such as textual data using some character encoding, the contents of files, JSON, etc.).

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Abstract methods

def asArray(implicit trace: Trace): Task[Array[Byte]]

Returns an effect that decodes the content of the body as array of bytes. Note that attempting to decode a large stream of bytes into an array could result in an out of memory error.

Returns an effect that decodes the content of the body as array of bytes. Note that attempting to decode a large stream of bytes into an array could result in an out of memory error.

Attributes

def asChunk(implicit trace: Trace): Task[Chunk[Byte]]

Returns an effect that decodes the content of the body as a chunk of bytes. Note that attempting to decode a large stream of bytes into a chunk could result in an out of memory error.

Returns an effect that decodes the content of the body as a chunk of bytes. Note that attempting to decode a large stream of bytes into a chunk could result in an out of memory error.

Attributes

def asStream(implicit trace: Trace): ZStream[Any, Throwable, Byte]

Returns a stream that contains the bytes of the body. This method is safe to use with large bodies, because the elements of the returned stream are lazily produced from the body.

Returns a stream that contains the bytes of the body. This method is safe to use with large bodies, because the elements of the returned stream are lazily produced from the body.

Attributes

Returns whether or not the bytes of the body have been fully read.

Returns whether or not the bytes of the body have been fully read.

Attributes

Concrete methods

def asMultipartForm(implicit trace: Trace): Task[Form]

Returns an effect that decodes the content of the body as a multipart form. Note that attempting to decode a large stream of bytes into a form could result in an out of memory error.

Returns an effect that decodes the content of the body as a multipart form. Note that attempting to decode a large stream of bytes into a form could result in an out of memory error.

Attributes

Returns an effect that decodes the streaming body as a multipart form.

Returns an effect that decodes the streaming body as a multipart form.

The result is a stream of FormField objects, where each FormField may be a StreamingBinary or a Text object. The StreamingBinary object contains a stream of bytes, which has to be consumed asynchronously by the user to get the next FormField from the stream.

Attributes

final def asString(implicit trace: Trace): Task[String]

Decodes the content of the body as a string with the default charset. Note that attempting to decode a large stream of bytes into a string could result in an out of memory error.

Decodes the content of the body as a string with the default charset. Note that attempting to decode a large stream of bytes into a string could result in an out of memory error.

Attributes

final def asString(charset: Charset)(implicit trace: Trace): Task[String]

Decodes the content of the body as a string with the provided charset. Note that attempting to decode a large stream of bytes into a string could result in an out of memory error.

Decodes the content of the body as a string with the provided charset. Note that attempting to decode a large stream of bytes into a string could result in an out of memory error.

Attributes

def asURLEncodedForm(implicit trace: Trace): Task[Form]

Returns an effect that decodes the content of the body as form data.

Returns an effect that decodes the content of the body as form data.

Attributes