Response

org.http4s.Response
See theResponse companion object
final class Response[F[_]] extends Message[F], Product, Serializable

Representation of the HTTP response to send back to the client

Value parameters

attributes

org.typelevel.vault.Vault containing additional parameters which may be used by the http4s backend for additional processing such as java.io.File object

body

EntityBody[F] representing the possible body of the response

headers

Headers containing all response headers

status

Status code and message

Attributes

Companion
object
Source
Message.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Message[F]
trait Media[F]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

type SelfF[F0[_]] = Response[F0]

Attributes

Source
Message.scala

Inherited types

type Self = SelfF[F]

Attributes

Inherited from:
Message
Source
Message.scala

Value members

Concrete methods

Add a Set-Cookie header for the provided ResponseCookie

Add a Set-Cookie header for the provided ResponseCookie

Attributes

Source
Message.scala

Add a org.http4s.headers.Set-Cookie header with the provided values

Add a org.http4s.headers.Set-Cookie header with the provided values

Attributes

Source
Message.scala
def canEqual(that: Any): Boolean

Attributes

Source
Message.scala

Returns a list of cookies from the org.http4s.headers.Set-Cookie headers. Includes expired cookies, such as those that represent cookie deletion.

Returns a list of cookies from the org.http4s.headers.Set-Cookie headers. Includes expired cookies, such as those that represent cookie deletion.

Attributes

Source
Message.scala
override def hashCode(): Int

Calculate a hash code value for the object.

Calculate a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
Source
Message.scala
def mapK[G[_]](f: FunctionK[F, G]): Response[G]

Attributes

Source
Message.scala

Attributes

Source
Message.scala
def productElement(n: Int): Any

Attributes

Source
Message.scala

Add a org.http4s.headers.Set-Cookie which will remove the specified cookie from the client

Add a org.http4s.headers.Set-Cookie which will remove the specified cookie from the client

Attributes

Source
Message.scala

Add a org.http4s.headers.Set-Cookie which will remove the specified cookie from the client

Add a org.http4s.headers.Set-Cookie which will remove the specified cookie from the client

Attributes

Source
Message.scala

A projection of this response without the body.

A projection of this response without the body.

Attributes

Source
Message.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
Message.scala

Attributes

Source
Message.scala

Inherited methods

def addHeader[H : ([H] =>> Header[H, Recurring])](h: H): Self

Add a header to these headers. The header should be a type with a recurring Header instance to ensure that the new value can be appended to any existing values.

Add a header to these headers. The header should be a type with a recurring Header instance to ensure that the new value can be appended to any existing values.

>>> import cats.effect.IO
>>> import org.http4s.headers.Accept

>>> val req = Request[IO]().addHeader(Accept(MediaRange.`application/*`))
>>> req.headers.get[Accept]
Some(Accept(NonEmptyList(application/*)))

>>> val req2 = req.addHeader(Accept(MediaRange.`text/*`))
>>> req2.headers.get[Accept]
Some(Accept(NonEmptyList(application/*, text/*)))

////*/

Attributes

Inherited from:
Message
Source
Message.scala
final def as[A](implicit F: MonadThrow[F], decoder: EntityDecoder[F, A]): F[A]

Decode the Media to the specified type

Decode the Media to the specified type

If no valid Status has been described, allow Ok

Type parameters

A

type of the result

Value parameters

decoder

EntityDecoder used to decode the Media

Attributes

Returns

the effect which will generate the A

Inherited from:
Media
Source
Media.scala
final def attemptAs[T](implicit decoder: EntityDecoder[F, T]): DecodeResult[F, T]

Decode the Media to the specified type

Decode the Media to the specified type

Type parameters

T

type of the result

Value parameters

decoder

EntityDecoder used to decode the Media

Attributes

Returns

the effect which will generate the DecodeResult[T]

Inherited from:
Media
Source
Media.scala
final def bodyText(implicit RT: RaiseThrowable[F], defaultCharset: Charset): Stream[F, String]

Attributes

Inherited from:
Media
Source
Media.scala
final def charset: Option[Charset]

Attributes

Inherited from:
Media
Source
Media.scala
final def contentLength: Option[Long]

Attributes

Inherited from:
Media
Source
Media.scala

Attributes

Inherited from:
Media
Source
Media.scala
override def covary[F2[x]]: SelfF[F2]

Lifts this Message's body to the specified effect type.

Lifts this Message's body to the specified effect type.

Attributes

Definition Classes
Inherited from:
Message
Source
Message.scala

Keep headers that satisfy the predicate

Keep headers that satisfy the predicate

Value parameters

f

predicate

Attributes

Returns

a new message object which has only headers that satisfy the predicate

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Add the provided headers to the existing headers, replacing those of the same header name

Add the provided headers to the existing headers, replacing those of the same header name

>>> import cats.effect.IO
>>> import org.http4s.headers.Accept

>>> val req = Request[IO]().putHeaders(Accept(MediaRange.`application/*`))
>>> req.headers.get[Accept]
Some(Accept(NonEmptyList(application/*)))

>>> val req2 = req.putHeaders(Accept(MediaRange.`text/*`))
>>> req2.headers.get[Accept]
Some(Accept(NonEmptyList(text/*)))

////

Attributes

Inherited from:
Message
Source
Message.scala
def removeHeader[A](implicit h: Header[A, _]): Self

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala
def toStrict(maxBytes: Option[Long])(implicit F: Concurrent[F]): F[Self]

Compiles the body stream to a single chunk and sets it as the body. Replaces any Transfer-Encoding: chunked with a Content-Length header. It is the caller's responsibility to assure there is enough memory to materialize the entity body and control the time limits of that materialization.

Compiles the body stream to a single chunk and sets it as the body. Replaces any Transfer-Encoding: chunked with a Content-Length header. It is the caller's responsibility to assure there is enough memory to materialize the entity body and control the time limits of that materialization.

Value parameters

maxBytes

maximum length of the entity stream. If the stream exceeds the limit then processing fails with the Message.EntityStreamException. Pass the scala.None if you don't want to limit the entity body.

Attributes

Inherited from:
Message
Source
Message.scala
def trailerHeaders(implicit F: Applicative[F]): F[Headers]

The trailer headers, as specified in Section 3.6.1 of RFC 2616. The resulting F might not complete until the entire body has been consumed.

The trailer headers, as specified in Section 3.6.1 of RFC 2616. The resulting F might not complete until the entire body has been consumed.

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala
def withAttribute[A](key: Key[A], value: A): Self

Generates a new message object with the specified key/value pair appended to the attributes.

Generates a new message object with the specified key/value pair appended to the attributes.

Type parameters

A

type of the value to store

Value parameters

key

org.typelevel.vault.Key with which to associate the value

value

value associated with the key

Attributes

Returns

a new message object with the key/value pair appended

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Set an empty entity body on this message, and remove all payload headers that make no sense with an empty body.

Set an empty entity body on this message, and remove all payload headers that make no sense with an empty body.

Attributes

Inherited from:
Message
Source
Message.scala
def withEntity[T](b: T)(implicit w: EntityEncoder[F, T]): Self

Replace the body of this message with a new body

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Returns a new message object without the specified key in the attributes.

Returns a new message object without the specified key in the attributes.

Value parameters

key

org.typelevel.vault.Key to remove

Attributes

Returns

a new message object without the key

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Attributes

Inherited from:
Message
Source
Message.scala

Concrete fields

Attributes

Source
Message.scala
val body: EntityBody[F]

Attributes

Source
Message.scala

Attributes

Source
Message.scala

Attributes

Source
Message.scala
val status: Status

Attributes

Source
Message.scala