Packages

final class Request[+F[_]] extends Message[F] with Product with Serializable

Representation of an incoming HTTP message

A Request encapsulates the entirety of the incoming HTTP request including the status line, headers, and a possible request body.

Source
Message.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Request
  2. Serializable
  3. Product
  4. Equals
  5. Message
  6. Media
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type SelfF[F0[_]] = Request[F0]
    Definition Classes
    RequestMessage

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addCookie(name: String, content: String): Request[F]

    Add a Cookie header with the provided values

  5. def addCookie(cookie: RequestCookie): Request[F]

    Add a Cookie header for the provided org.http4s.headers.Cookie

  6. 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/*)))

    */*/*/*/*/

    Definition Classes
    Message
  7. def asCurl(redactHeadersWhen: (CIString) => Boolean = Headers.SensitiveHeaders.contains): String

    cURL representation of the request.

    cURL representation of the request.

    Supported cURL-Parameters are: --request, --url, --header. Note that asCurl will not print the request body.

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. val attributes: Vault
    Definition Classes
    RequestMessage
  10. def authType: Option[AuthScheme]
  11. final def body: EntityBody[F]
    Definition Classes
    Media
  12. final def bodyText[F2[x] >: F[x]](implicit RT: RaiseThrowable[F2], defaultCharset: Charset = `UTF-8`): Stream[F2, String]
    Definition Classes
    Media
  13. def canEqual(that: Any): Boolean
    Definition Classes
    Request → Equals
  14. def change[F1[_]](httpVersion: HttpVersion, entity: Entity[F1], headers: Headers, attributes: Vault): Request[F1]
    Attributes
    protected
    Definition Classes
    RequestMessage
  15. final def charset: Option[Charset]
    Definition Classes
    Media
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  17. final def contentLength: Option[Long]
    Definition Classes
    Media
  18. final def contentType: Option[Content-Type]
    Definition Classes
    Media
  19. def cookies: List[RequestCookie]

    Parses all available org.http4s.headers.Cookie headers into a list of RequestCookie objects.

    Parses all available org.http4s.headers.Cookie headers into a list of RequestCookie objects. This implementation is compatible with cookie headers formatted per HTTP/1 and HTTP/2, or even both at the same time.

  20. def covary[F2[x] >: F[x]]: SelfF[F2]

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

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

    Definition Classes
    MessageMedia
  21. def decode[F2[x] >: F[x], A](f: (A) => F2[Response[F2]])(implicit F: Monad[F2], decoder: EntityDecoder[F2, A]): F2[Response[F2]]

    Helper method for decoding Requests

    Helper method for decoding Requests

    Attempt to decode the Request and, if successful, execute the continuation to get a Response. If decoding fails, an UnprocessableEntity Response is generated.

  22. def decodeStrict[F2[x] >: F[x], A](f: (A) => F2[Response[F2]])(implicit F: Monad[F2], decoder: EntityDecoder[F2, A]): F2[Response[F2]]

    Helper method for decoding Requests

    Helper method for decoding Requests

    Attempt to decode the Request and, if successful, execute the continuation to get a Response. If decoding fails, an UnprocessableEntity Response is generated. If the decoder does not support the MediaType of the Request, a UnsupportedMediaType Response is generated instead.

  23. def decodeWith[F2[x] >: F[x], A](decoder: EntityDecoder[F2, A], strict: Boolean)(f: (A) => F2[Response[F2]])(implicit F: Monad[F2]): F2[Response[F2]]
  24. val entity: Entity[F]
    Definition Classes
    RequestMedia
  25. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  27. 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

    Definition Classes
    Message
  28. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  29. def from: Option[IpAddress]

    Returns the the X-Forwarded-For value if present, else the remote address.

  30. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def hasKnownPureEntity: Boolean

    Checks whether the Entity of the Message is pure in the sense of indicating that the entity body can be re-run without side effects.

    Checks whether the Entity of the Message is pure in the sense of indicating that the entity body can be re-run without side effects.

    returns

    the Boolean value: 'true' if entity is empty or already loaded into memory; 'false' if entity is streamed.

  32. def hashCode(): Int
    Definition Classes
    Request → AnyRef → Any
  33. val headers: Headers
    Definition Classes
    RequestMedia
  34. val httpVersion: HttpVersion
    Definition Classes
    RequestMessage
  35. def isChunked: Boolean
    Definition Classes
    Message
  36. def isIdempotent: Boolean

    A request is idempotent if its method is idempotent or it contains an Idempotency-Key header.

  37. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  38. def isSecure: Option[Boolean]

    Whether the Request was received over a secure medium

  39. def mapK[F2[x] >: F[x], G[_]](f: ~>[F2, G]): SelfF[G]
    Definition Classes
    Message
  40. val method: Method
  41. def multiParams: Map[String, List[String]]

    Representation of the query string as a map

    Representation of the query string as a map

    In case a parameter is available in query string but no value is there the list will be empty. If the value is empty the the list contains an empty string.

    Examples

    Query StringMap
    ?param=vMap("param" -> List("v"))
    ?param=Map("param" -> List(""))
    ?paramMap("param" -> List())
    ?=valueMap("" -> List("value"))
    ?p1=v1&p1=v2&p2=v3&p2=v4Map("p1" -> List("v1","v2"), "p2" -> List("v3","v4"))

    The query string is lazily parsed. If an error occurs during parsing an empty Map is returned.

  42. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  43. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  44. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  45. def params: Map[String, String]

    View of the head elements of the URI parameters in query string.

    View of the head elements of the URI parameters in query string.

    In case a parameter has no value the map returns an empty string.

    See also

    multiParams

  46. lazy val pathInfo: Path
  47. def pathTranslated: Option[File]
  48. def productArity: Int
    Definition Classes
    Request → Product
  49. def productElement(n: Int): Any
    Definition Classes
    Request → Product
  50. def productElementName(n: Int): String
    Definition Classes
    Product
  51. def productElementNames: Iterator[String]
    Definition Classes
    Product
  52. def productIterator: Iterator[Any]
    Definition Classes
    Product
  53. def productPrefix: String
    Definition Classes
    Product
  54. 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/*)))

    */*/*/*/

    Definition Classes
    Message
  55. def queryString: String
  56. def remote: Option[SocketAddress[IpAddress]]
  57. def remoteAddr: Option[IpAddress]
  58. def remoteHost[F1[x] >: F[x]](implicit F: Monad[F1], dns: Dns[F1]): F1[Option[Hostname]]
  59. def remotePort: Option[Port]
  60. def remoteUser: Option[String]
  61. def removeHeader[A](implicit h: Header[A, _]): SelfF[F]
    Definition Classes
    Message
  62. def removeHeader(key: CIString): SelfF[F]
    Definition Classes
    Message
  63. def requestPrelude: RequestPrelude

    A projection of this request without the body.

  64. lazy val scriptName: Path
  65. def server: Option[SocketAddress[IpAddress]]
  66. def serverAddr: Option[IpAddress]
  67. def serverPort: Option[Port]
  68. def serverSoftware: ServerSoftware
  69. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  70. 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 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.

    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.

    Definition Classes
    Message
  71. def toString(): String
    Definition Classes
    Request → AnyRef → Any
  72. 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.

    Definition Classes
    Message
  73. def transformHeaders(f: (Headers) => Headers): SelfF[F]
    Definition Classes
    Message
  74. val uri: Uri
  75. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  76. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  77. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  78. 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

    Definition Classes
    Message
  79. def withAttributes(attributes: Vault): SelfF[F]
    Definition Classes
    Message
  80. def withBodyStream[F1[x] >: F[x]](body: EntityBody[F1]): SelfF[F1]

    Sets the entity body without affecting headers such as Transfer-Encoding or Content-Length.

    Sets the entity body without affecting headers such as Transfer-Encoding or Content-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.

    Definition Classes
    Message
  81. def withContentType(contentType: Content-Type): SelfF[F]
    Definition Classes
    Message
  82. def withContentTypeOption(contentTypeO: Option[Content-Type]): SelfF[F]
    Definition Classes
    Message
  83. 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.

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

    Definition Classes
    Message
  84. def withEntity[F1[x]](entity: Entity[F1]): SelfF[F1]
    Definition Classes
    Message
  85. 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 Entity

    returns

    a new message with the new body

    Definition Classes
    Message
  86. def withHeaders(headers: ToRaw*): SelfF[F]
    Definition Classes
    Message
  87. def withHeaders(headers: Headers): SelfF[F]
    Definition Classes
    Message
  88. def withHttpVersion(httpVersion: HttpVersion): SelfF[F]
    Definition Classes
    Message
  89. def withMethod(method: Method): Request[F]
  90. def withPathInfo(pi: Path): Request[F]
  91. def withTrailerHeaders[F1[x] >: F[x]](trailerHeaders: F1[Headers]): SelfF[F1]
    Definition Classes
    Message
  92. def withUri(uri: Uri): Request[F]
  93. 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

    Definition Classes
    Message
  94. def withoutContentType: SelfF[F]
    Definition Classes
    Message
  95. def withoutTrailerHeaders: SelfF[F]
    Definition Classes
    Message

Deprecated Value Members

  1. def withPathInfo(pi: String): Request[F]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.22.0-M1) Use {withPathInfo(Uri.Path)} instead

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Message[F]

Inherited from Media[F]

Inherited from AnyRef

Inherited from Any

Ungrouped