final case class Response(status: Status = Status.Ok, headers: Headers = Headers.empty, body: Body = Body.empty) extends HeaderOps[Response] with Product with Serializable
- Self Type
- Response
- Alphabetic
- By Inheritance
- Response
- Serializable
- Product
- Equals
- HeaderOps
- HeaderChecks
- HeaderGetters
- HeaderModifier
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Response(status: Status = Status.Ok, headers: Headers = Headers.empty, body: Body = Body.empty)
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
- def addCookie(cookie: Cookie.Response): Response
- def addCookies(cookie: Cookie.Response, cookies: Cookie.Response*): Response
- def addFlash[A](setter: Setter[A]): Response
Adds flash values to the cookie-based flash-scope.
- final def addHeader[T](value: T)(implicit schema: Schema[T]): Response
Adds headers based on the given value.
Adds headers based on the given value. The type of the value must have a schema and be a case class and all fields will be added as headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. The header names are the field names.
- Definition Classes
- HeaderModifier
- final def addHeader[T](name: String, value: T)(implicit schema: Schema[T]): Response
Adds a header / headers with the specified name and based on the given value.
Adds a header / headers with the specified name and based on the given value. The value type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.
- Definition Classes
- HeaderModifier
- def addHeader(name: CharSequence, value: CharSequence): Response
- Attributes
- protected
- Definition Classes
- HeaderModifier
- final def addHeader(header: Header): Response
- Definition Classes
- HeaderModifier
- final def addHeaders(headers: Iterable[(CharSequence, CharSequence)]): Response
- Definition Classes
- HeaderModifier
- final def addHeaders(headers: Headers): Response
- Definition Classes
- HeaderModifier
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val body: Body
- def bodyAs[A](implicit codec: BinaryCodec[A], trace: Trace): Task[A]
Decodes the content of the body as a value based on a zio-schema zio.schema.codec.BinaryCodec.
Decodes the content of the body as a value based on a zio-schema zio.schema.codec.BinaryCodec.
Example for json:
import zio.schema.json.codec._ case class Person(name: String, age: Int) implicit val schema: Schema[Person] = DeriveSchema.gen[Person] val response = ??? val decodedPerson = response.to[Person]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def collect(implicit trace: Trace): ZIO[Any, Nothing, Response]
Collects the potentially streaming body of the response into a single chunk.
Collects the potentially streaming body of the response into a single chunk.
Any errors that occur from the collection of the body will be caught and propagated to the Body
- def contentType(mediaType: MediaType): Response
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def hasContentType(mediaType: MediaType): Boolean
- Definition Classes
- HeaderChecks
- final def hasContentType(value: CharSequence): Boolean
- Definition Classes
- HeaderChecks
- final def hasFormMultipartContentType: Boolean
- Definition Classes
- HeaderChecks
- final def hasFormUrlencodedContentType: Boolean
- Definition Classes
- HeaderChecks
- final def hasHeader(header: Header): Boolean
- Definition Classes
- HeaderChecks
- final def hasHeader(headerType: HeaderType): Boolean
- Definition Classes
- HeaderChecks
- final def hasHeader(name: CharSequence): Boolean
- Definition Classes
- HeaderChecks
- final def hasJsonContentType: Boolean
- Definition Classes
- HeaderChecks
- final def hasTextPlainContentType: Boolean
- Definition Classes
- HeaderChecks
- final def hasXhtmlXmlContentType: Boolean
- Definition Classes
- HeaderChecks
- final def hasXmlContentType: Boolean
- Definition Classes
- HeaderChecks
- final def header[T](implicit schema: Schema[T]): Either[HeaderError, T]
Retrieves headers as a value of the specified type.
Retrieves headers as a value of the specified type. The type must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.
- Definition Classes
- HeaderGetters
- final def header[T](name: String)(implicit schema: Schema[T]): Either[HeaderError, T]
Retrieves the header with the specified name as a value of the specified type.
Retrieves the header with the specified name as a value of the specified type. The type must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.
- Definition Classes
- HeaderGetters
- final def header(headerType: HeaderType): Option[HeaderValue]
Gets a header or returns None if the header was not present or it could not be parsed
Gets a header or returns None if the header was not present or it could not be parsed
- Definition Classes
- HeaderGetters
- final def headerOrElse[T](default: => T)(implicit schema: Schema[T]): T
Retrieves headers as a value of the specified type T, or returns a default value if the headers are not present or could not be parsed.
Retrieves headers as a value of the specified type T, or returns a default value if the headers are not present or could not be parsed. The type T must have a schema and be a case class and all fields must be headers. So fields must be of primitive types (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these. Headers are selected by field names.
- Definition Classes
- HeaderGetters
- final def headerOrElse[T](name: String, default: => T)(implicit schema: Schema[T]): T
Retrieves the header with the specified name as a value of the specified type T, or returns a default value if the header is not present or could not be parsed.
Retrieves the header with the specified name as a value of the specified type T, or returns a default value if the header is not present or could not be parsed. The type T must have a schema and can be a primitive type (e.g. Int, String, UUID, Instant etc.), a case class with a single field or a collection of either of these.
- Definition Classes
- HeaderGetters
- final def headerOrFail(headerType: HeaderType): Option[Either[String, HeaderValue]]
Gets a header.
Gets a header. If the header is not present, returns None. If the header could not be parsed it returns the parsing error
- Definition Classes
- HeaderGetters
- final def headerZIO[T](name: String)(implicit schema: Schema[T]): IO[HeaderError, T]
- Definition Classes
- HeaderGetters
- final def headers(headerType: HeaderType): Chunk[HeaderValue]
- Definition Classes
- HeaderGetters
- val headers: Headers
Returns the headers
Returns the headers
- Definition Classes
- Response → HeaderGetters
- def ignoreBody(implicit trace: Trace): ZIO[Any, Nothing, Response]
Consumes the streaming body fully and then discards it while also ignoring any failures
- 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()
- def patch(p: Patch)(implicit trace: Trace): Response
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def rawHeader(headerType: HeaderType): Option[String]
Gets the raw unparsed header value
Gets the raw unparsed header value
- Definition Classes
- HeaderGetters
- final def rawHeader(name: CharSequence): Option[String]
Gets the raw unparsed header value
Gets the raw unparsed header value
- Definition Classes
- HeaderGetters
- def rawHeaders(name: CharSequence): Chunk[String]
- Definition Classes
- HeaderGetters
- final def removeHeader(name: String): Response
- Definition Classes
- HeaderModifier
- final def removeHeader(headerType: HeaderType): Response
- Definition Classes
- HeaderModifier
- final def removeHeaders(headers: Set[String]): Response
- Definition Classes
- HeaderModifier
- final def setHeaders(headers: Headers): Response
- Definition Classes
- HeaderModifier
- def status(status: Status): Response
Sets the status of the response
- val status: Status
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toHandler(implicit trace: Trace): Handler[Any, Nothing, Any, Response]
Creates an Http from a Response
- def updateHeaders(update: (Headers) => Headers)(implicit trace: Trace): Response
Updates the current Headers with new one, using the provided update function passed.
Updates the current Headers with new one, using the provided update function passed.
- Definition Classes
- Response → HeaderModifier
- 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])