sealed trait Message[+F[_]] extends Media[F]
Represents a HTTP Message. The interesting subclasses are Request and Response.
- Self Type
- Message[F]
- Source
- Message.scala
- Alphabetic
- By Inheritance
- Message
- Media
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
Abstract Value Members
- abstract def attributes: Vault
- abstract def change[F1[_]](httpVersion: HttpVersion = httpVersion, entity: Entity[F1] = entity, headers: Headers = headers, attributes: Vault = attributes): SelfF[F1]
- Attributes
- protected
- abstract def entity: Entity[F]
- Definition Classes
- Media
- abstract def headers: Headers
- Definition Classes
- Media
- abstract def httpVersion: HttpVersion
Concrete 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 addHeader[H](h: H)(implicit arg0: Header[H, Recurring]): SelfF[F]
Add a header to these headers.
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 org.http4s.headers.Accept >>> val req = Request().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/*)))
*/*/*/*/*/
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def body: EntityBody[F]
- Definition Classes
- Media
- final def bodyText[F2[x] >: F[x]](implicit RT: RaiseThrowable[F2], defaultCharset: Charset = `UTF-8`): Stream[F2, String]
- Definition Classes
- Media
- final def charset: Option[Charset]
- Definition Classes
- Media
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def contentLength: Option[Long]
- Definition Classes
- Media
- final def contentType: Option[Content-Type]
- Definition Classes
- Media
- def covary[F2[x] >: F[x]]: SelfF[F2]
Lifts this Message's body to the specified effect type.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filterHeaders(f: (Raw) => Boolean): SelfF[F]
Keep headers that satisfy the predicate
Keep headers that satisfy the predicate
- f
predicate
- returns
a new message object which has only headers that satisfy the predicate
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def isChunked: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mapK[F2[x] >: F[x], G[_]](f: ~>[F2, G]): SelfF[G]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def putHeaders(headers: ToRaw*): SelfF[F]
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 org.http4s.headers.Accept >>> val req = Request().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/*)))
*/*/*/*/
- def removeHeader[A](implicit h: Header[A, _]): SelfF[F]
- def removeHeader(key: CIString): SelfF[F]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toStrict[F1[x] >: F[x]](maxBytes: Option[Long])(implicit F: Concurrent[F1]): F1[SelfF[Pure]]
Compiles the body stream to a single chunk and sets it as the body.
Compiles the body stream to a single chunk and sets it as the body. Replaces any
Transfer-Encoding: chunked
with aContent-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.- 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.
- def toString(): String
- Definition Classes
- AnyRef → Any
- def trailerHeaders[F1[x] >: F[x]](implicit F: Applicative[F1]): F1[Headers]
The trailer headers, as specified in Section 3.6.1 of RFC 2616.
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.
- def transformHeaders(f: (Headers) => Headers): SelfF[F]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
- def withAttribute[A](key: Key[A], value: A): SelfF[F]
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.
- 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
- def withAttributes(attributes: Vault): SelfF[F]
- def withBodyStream[F1[x] >: F[x]](body: EntityBody[F1]): SelfF[F1]
Sets the entity body without affecting headers such as
Transfer-Encoding
orContent-Length
.Sets the entity body without affecting headers such as
Transfer-Encoding
orContent-Length
. Most use cases are better served by withEntity[F1[x]](entity*, which uses an EntityEncoder to maintain the headers.WARNING: this method does not modify the headers of the message, and as a consequence headers may be incoherent with the body.
- def withContentType(contentType: Content-Type): SelfF[F]
- def withContentTypeOption(contentTypeO: Option[Content-Type]): SelfF[F]
- def withEmptyBody: SelfF[Pure]
Set an Entity.Empty entity on this message, and remove all payload headers that make no sense with an empty body.
- def withEntity[F1[x]](entity: Entity[F1]): SelfF[F1]
- def withEntity[F1[x] >: F[x], T](b: T)(implicit w: EntityEncoder[F1, T]): SelfF[F1]
Replace the body of this message with a new body
Replace the body of this message with a new body
- T
type of the Body
- b
body to attach to this method
- w
EntityEncoder with which to convert the body to an EntityBody
- returns
a new message with the new body
- def withHeaders(headers: ToRaw*): SelfF[F]
- def withHeaders(headers: Headers): SelfF[F]
- def withHttpVersion(httpVersion: HttpVersion): SelfF[F]
- def withTrailerHeaders[F1[x] >: F[x]](trailerHeaders: F1[Headers]): SelfF[F1]
- def withoutAttribute(key: Key[_]): SelfF[F]
Returns a new message object without the specified key in the attributes.
Returns a new message object without the specified key in the attributes.
- key
org.typelevel.vault.Key to remove
- returns
a new message object without the key
- def withoutContentType: SelfF[F]
- def withoutTrailerHeaders: SelfF[F]