Packages

object Body

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Body
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final case class ByteRange(start: Long, end: Long, totalSize: Long, contentType: MediaType, data: ZStream[Any, Throwable, Byte]) extends Product with Serializable

    Represents a single byte range for multipart/byteranges responses.

    Represents a single byte range for multipart/byteranges responses.

    start

    The starting byte position (inclusive)

    end

    The ending byte position (inclusive)

    totalSize

    The total size of the complete resource

    contentType

    The content type of this part

    data

    The stream of bytes for this range

  2. final case class ContentType(mediaType: MediaType, boundary: Option[Boundary] = None, charset: Option[Charset] = None) extends Product with Serializable

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. val empty: Body

    A body that contains no data.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. 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)
  10. 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.

  11. def fromCharSequence(charSequence: CharSequence, charset: Charset = Charsets.Http): Body

    Constructs a zio.http.Body from the contents of a file.

  12. 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.

  13. 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.

  14. def fromCharSequenceStreamChunkedEnv[R](stream: ZStream[R, Throwable, CharSequence], charset: Charset = Charsets.Http)(implicit trace: Trace): RIO[R, Body]

    Constructs a zio.http.Body from a stream of text with unknown length using chunked transfer encoding that depends on R, using the specified character set, which defaults to the HTTP character set.

  15. def fromCharSequenceStreamEnv[R](stream: ZStream[R, Throwable, CharSequence], contentLength: Long, charset: Charset = Charsets.Http)(implicit trace: Trace): RIO[R, Body]

    Constructs a zio.http.Body from a stream of text with known length that depends on R, using the specified character set, which defaults to the HTTP character set.

  16. def fromChunk(data: Chunk[Byte], contentType: ContentType): Body
  17. def fromChunk(data: Chunk[Byte], mediaType: MediaType): Body

    Constructs a zio.http.Body from a chunk of bytes and sets the media type.

  18. def fromChunk(data: Chunk[Byte]): Body

    Constructs a zio.http.Body from a chunk of bytes.

  19. 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.

  20. def fromFileRange(file: File, offset: Long, length: Long, chunkSize: Int = 1024 * 4)(implicit trace: Trace): ZIO[Any, Nothing, Body]

    Constructs a zio.http.Body from a range of bytes within a file.

    Constructs a zio.http.Body from a range of bytes within a file. This is useful for serving partial content in response to HTTP Range requests.

    file

    The file to read from

    offset

    The starting byte position (0-based)

    length

    The number of bytes to read

    chunkSize

    The size of chunks to use when streaming

  21. def fromMultipartByteRanges(ranges: Chunk[ByteRange], boundary: Boundary)(implicit trace: Trace): Body

    Constructs a zio.http.Body from multiple byte ranges, using multipart/byteranges encoding as specified in RFC 9110 Section 14.6.

    Constructs a zio.http.Body from multiple byte ranges, using multipart/byteranges encoding as specified in RFC 9110 Section 14.6.

    This is used to respond to HTTP Range requests that specify multiple ranges.

    ranges

    The list of byte ranges to include in the response

    boundary

    The boundary to use for separating parts

  22. def fromMultipartByteRangesUUID(ranges: Chunk[ByteRange])(implicit trace: Trace): UIO[Body]

    Constructs a zio.http.Body from multiple byte ranges with a randomly generated boundary.

  23. 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.

  24. 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.

  25. def fromSocketApp(app: WebSocketApp[Any]): WebsocketBody
  26. 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)
  27. def fromStream(stream: ZStream[Any, Throwable, Byte], contentLength: Long): Body

    Constructs a zio.http.Body from a stream of bytes with a known length.

  28. 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.

  29. def fromStreamChunkedEnv[R](stream: ZStream[R, Throwable, Byte])(implicit trace: Trace): RIO[R, Body]

    Constructs a zio.http.Body from a stream of bytes of unknown length that depends on R, using chunked transfer encoding.

  30. def fromStreamEnv[A, R](stream: ZStream[R, Throwable, A])(implicit codec: BinaryCodec[A], trace: Trace): RIO[R, Body]

    Constructs a zio.http.Body from stream of values based on a zio-schema zio.schema.codec.BinaryCodec and depends on R

  31. def fromStreamEnv[R](stream: ZStream[R, Throwable, Byte], contentLength: Long)(implicit trace: Trace): RIO[R, Body]

    Constructs a zio.http.Body from a stream of bytes with a known length that depends on R.

  32. def fromString(text: String, charset: Charset = Charsets.Http): Body

    Helper to create Body from String

  33. 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.

  34. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  35. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. def json[A](a: A)(implicit schema: Schema[A]): Body

    Constructs a zio.http.Body from a value as JSON using zio-schema.

    Constructs a zio.http.Body from a value as JSON using zio-schema.

    Example:

    import zio.schema.{DeriveSchema, Schema}
    case class Person(name: String, age: Int)
    implicit val schema: Schema[Person] = DeriveSchema.gen[Person]
    val person = Person("John", 42)
    val body = Body.json(person)
  38. def jsonCodec[A](a: A)(implicit encoder: JsonEncoder[A]): Body

    Constructs a zio.http.Body from a value as JSON using zio-json.

    Constructs a zio.http.Body from a value as JSON using zio-json.

    Example:

    import zio.json._
    case class Person(name: String, age: Int)
    implicit val encoder: JsonEncoder[Person] = DeriveJsonEncoder.gen[Person]
    val person = Person("John", 42)
    val body = Body.jsonZio(person)
  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  41. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  42. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  43. def toString(): String
    Definition Classes
    AnyRef → Any
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  47. object ContentType extends Serializable

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped