Attributes
Members list
Type members
Classlikes
Represents a single byte range for multipart/byteranges responses.
Represents a single byte range for multipart/byteranges responses.
Value parameters
- contentType
-
The content type of this part
- data
-
The stream of bytes for this range
- end
-
The ending byte position (inclusive)
- start
-
The starting byte position (inclusive)
- totalSize
-
The total size of the complete resource
Attributes
- Supertypes
Attributes
- Companion
- class
- Supertypes
- Self type
-
ContentType.type
Value members
Concrete methods
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)
Attributes
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.
Attributes
Constructs a zio.http.Body from the contents of a file.
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.
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.
Attributes
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.
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.
Attributes
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.
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.
Attributes
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.
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.
Attributes
Constructs a zio.http.Body from a chunk of bytes.
Constructs a zio.http.Body from a chunk of bytes and sets the media type.
Constructs a zio.http.Body from the contents of 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.
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.
Value parameters
- chunkSize
-
The size of chunks to use when streaming
- file
-
The file to read from
- length
-
The number of bytes to read
- offset
-
The starting byte position (0-based)
Attributes
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.
Value parameters
- boundary
-
The boundary to use for separating parts
- ranges
-
The list of byte ranges to include in the response
Attributes
Constructs a zio.http.Body from multiple byte ranges with a randomly generated boundary.
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.
Attributes
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.
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.
Attributes
Constructs a zio.http.Body from a stream of bytes with a known length.
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)
Attributes
Constructs a zio.http.Body from a stream of bytes of unknown length, using chunked transfer encoding.
Constructs a zio.http.Body from a stream of bytes of unknown length, using chunked transfer encoding.
Attributes
Constructs a zio.http.Body from a stream of bytes of unknown length that depends on R, using chunked transfer encoding.
Constructs a zio.http.Body from a stream of bytes of unknown length that depends on R, using chunked transfer encoding.
Attributes
Constructs a zio.http.Body from a stream of bytes with a known length that depends on R.
Constructs a zio.http.Body from stream of values based on a zio-schema zio.schema.codec.BinaryCodec and depends on R
Constructs a zio.http.Body from stream of values based on a zio-schema zio.schema.codec.BinaryCodec and depends on R
Attributes
Helper to create Body from String
Helper to create Body from String
Attributes
Constructs a zio.http.Body from form data using URL encoding and the default character set.
Constructs a zio.http.Body from form data using URL encoding and the default character set.
Attributes
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)
Attributes
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)