Message

org.http4s.Message
See theMessage companion object
sealed trait Message[F[_]] extends Media[F]

Represents a HTTP Message. The interesting subclasses are Request and Response.

Attributes

Companion:
object
Source:
Message.scala
Graph
Supertypes
trait Media[F]
class Object
trait Matchable
class Any
Known subtypes
class Request[F]
class Response[F]
Self type

Members list

Concise view

Type members

Types

type Self = SelfF[F]

Attributes

Source:
Message.scala
type SelfF[F2[_]] <: Message[F2] { type SelfF = [F3[_]] =>> SelfF[F3]; }

Attributes

Source:
Message.scala

Value members

Abstract methods

Attributes

Source:
Message.scala

Attributes

Source:
Message.scala

Attributes

Source:
Message.scala

Concrete 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

Source:
Message.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
Source:
Message.scala

Keep headers that satisfy the predicate

Keep headers that satisfy the predicate

Attributes

f

predicate

Returns:

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

Source:
Message.scala

Attributes

Source:
Message.scala

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

Source:
Message.scala

Attributes

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

Attributes

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.

Attributes

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.

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

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.

Attributes

A

type of the value to store

key

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

value

value associated with the key

Returns:

a new message object with the key/value pair appended

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

Source:
Message.scala

Attributes

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.

Attributes

key

org.typelevel.vault.Key to remove

Returns:

a new message object without the key

Source:
Message.scala

Inherited methods

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

Attributes

A

type of the result

decoder

EntityDecoder used to decode the Media

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

Attributes

T

type of the result

decoder

EntityDecoder used to decode the Media

Returns:

the effect which will generate the DecodeResult[T]

Inherited from:
Media
Source:
Media.scala

Attributes

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

Attributes

Inherited from:
Media
Source:
Media.scala

Attributes

Inherited from:
Media
Source:
Media.scala

Attributes

Inherited from:
Media
Source:
Media.scala