Body

zio.http.Body
See theBody companion class
object Body

Attributes

Companion
class
Source
Body.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Body.type

Members list

Value members

Concrete methods

def fromArray(bytes: Array[Byte], contentType: ContentType = ...): Body

Creates a body from a byte array without a defensive copy.

Creates a body from a byte array without a defensive copy.

The resulting body aliases the supplied mutable array. Mutating the array after calling this method mutates the body contents too. Use this only when ownership of the array has been transferred to the body.

Attributes

Source
Body.scala
def fromChunk(chunk: Chunk[Byte], contentType: ContentType = ...): Body

Creates a body from a Chunk[Byte].

Creates a body from a Chunk[Byte].

The resulting body has a known chunk and known length, enabling structural equality and O(1) length queries.

Attributes

Source
Body.scala
def fromStream(stream: Stream[Nothing, Byte], contentType: ContentType = ...): Body

Creates a body from an arbitrary byte stream.

Creates a body from an arbitrary byte stream.

The stream's knownChunk and knownLength metadata determine whether structural equality and O(1) length queries are available.

Attributes

Source
Body.scala
def fromString(s: String, charset: Charset = ...): Body

Creates a body from a string, encoding with the given charset.

Creates a body from a string, encoding with the given charset.

Sets the content type to text/plain with the specified charset.

Attributes

Source
Body.scala

Concrete fields

val empty: Body

An empty body with no bytes and application/octet-stream content type.

An empty body with no bytes and application/octet-stream content type.

Attributes

Source
Body.scala