object Body
- Alphabetic
- By Inheritance
- Body
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- val empty: Body
A body that contains no data.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def from[A](a: A)(implicit codec: BinaryCodec[A], trace: Trace): Body
Constructs a zio.http.Body from a value based on a zio-schema zio.schema.codec.BinaryCodec.
Example for json:Constructs a zio.http.Body from a value based on a zio-schema zio.schema.codec.BinaryCodec.
Example for json:import zio.schema.codec.JsonCodec._ case class Person(name: String, age: Int) implicit val schema: Schema[Person] = DeriveSchema.gen[Person] val person = Person("John", 42) val body = Body.from(person)
- def fromArray(data: Array[Byte]): Body
Constructs a zio.http.Body from an array of bytes.
Constructs a zio.http.Body from an array of bytes.
WARNING: The array must not be mutated after creating the body.
- def fromCharSequence(charSequence: CharSequence, charset: Charset = Charsets.Http): Body
Constructs a zio.http.Body from the contents of a file.
- def fromCharSequenceStream(stream: ZStream[Any, Throwable, CharSequence], contentLength: Long, charset: Charset = Charsets.Http)(implicit trace: Trace): Body
Constructs a zio.http.Body from a stream of text with known length, using the specified character set, which defaults to the HTTP character set.
- def fromCharSequenceStreamChunked(stream: ZStream[Any, Throwable, CharSequence], charset: Charset = Charsets.Http)(implicit trace: Trace): Body
Constructs a zio.http.Body from a stream of text with unknown length using chunked transfer encoding, using the specified character set, which defaults to the HTTP character set.
- def fromChunk(data: Chunk[Byte], mediaType: MediaType): Body
Constructs a zio.http.Body from a chunk of bytes and sets the media type.
- def fromChunk(data: Chunk[Byte]): Body
Constructs a zio.http.Body from a chunk of bytes.
- def fromFile(file: File, chunkSize: Int = 1024 * 4)(implicit trace: Trace): ZIO[Any, Nothing, Body]
Constructs a zio.http.Body from the contents of a file.
- def fromMultipartForm(form: Form, specificBoundary: Boundary)(implicit trace: Trace): Body
Constructs a zio.http.Body from from form data, using multipart encoding and the specified character set, which defaults to UTF-8.
- def fromMultipartFormUUID(form: Form)(implicit trace: Trace): UIO[Body]
Constructs a zio.http.Body from from form data, using multipart encoding and the specified character set, which defaults to UTF-8.
Constructs a zio.http.Body from from form data, using multipart encoding and the specified character set, which defaults to UTF-8. Utilizes a random boundary based on a UUID.
- def fromSocketApp(app: WebSocketApp[Any]): WebsocketBody
- def fromStream[A](stream: ZStream[Any, Throwable, A])(implicit codec: BinaryCodec[A], trace: Trace): Body
Constructs a zio.http.Body from stream of values based on a zio-schema zio.schema.codec.BinaryCodec.
Constructs a zio.http.Body from stream of values based on a zio-schema zio.schema.codec.BinaryCodec.
Example for json:
import zio.schema.codec.JsonCodec._ case class Person(name: String, age: Int) implicit val schema: Schema[Person] = DeriveSchema.gen[Person] val persons = ZStream(Person("John", 42)) val body = Body.fromStream(persons)
- def fromStream(stream: ZStream[Any, Throwable, Byte], contentLength: Long): Body
Constructs a zio.http.Body from a stream of bytes with a known length.
- def fromStreamChunked(stream: ZStream[Any, Throwable, Byte]): Body
Constructs a zio.http.Body from a stream of bytes of unknown length, using chunked transfer encoding.
- def fromString(text: String, charset: Charset = Charsets.Http): Body
Helper to create Body from String
- def fromURLEncodedForm(form: Form, charset: Charset = StandardCharsets.UTF_8): Body
Constructs a zio.http.Body from form data using URL encoding and the default character set.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])