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.
Attributes
- attributes
Immutable Map used for carrying additional information in a type safe fashion
- body
fs2.Stream[F, Byte] defining the body of the request
- headers
collection of Headers
- httpVersion
the HTTP version
- method
Method.GET, Method.POST, etc.
- uri
representation of the request URI
- Companion:
- object
- Source:
- Message.scala
- Graph
- Supertypes
Members list
Type members
Types
Attributes
- Source:
- Message.scala
Inherited types
Attributes
- Inherited from:
- Message
- Source:
- Message.scala
Value members
Concrete methods
Add a Cookie header for the provided org.http4s.headers.Cookie
Add a Cookie header with the provided values
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.
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
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.
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.
Attributes
- Source:
- Message.scala
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.
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Returns the the X-Forwarded-For value if present, else the remote address.
Returns the the X-Forwarded-For value if present, else the remote address.
Attributes
- Source:
- Message.scala
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
A request is idempotent if its method is idempotent or it contains
an Idempotency-Key
header.
A request is idempotent if its method is idempotent or it contains
an Idempotency-Key
header.
Attributes
- Source:
- Message.scala
Whether the Request was received over a secure medium
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 sequence will be empty. If the value is empty the the sequence contains an empty string.
=====Examples=====
Query String | Map |
---|---|
?param=v | Map("param" -> Seq("v")) |
?param= | Map("param" -> Seq("")) |
?param | Map("param" -> Seq()) |
?=value | Map("" -> Seq("value")) |
?p1=v1&p1=v2&p2=v3&p2=v4 | Map("p1" -> Seq("v1","v2"), "p2" -> Seq("v3","v4")) |
The query string is lazily parsed. If an error occurs during parsing
an empty Map
is returned.
Attributes
- Source:
- Message.scala
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.
Attributes
- See also:
multiParams
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
A projection of this request without the body.
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
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
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Deprecated methods
Attributes
- Deprecated
- true
- Source:
- Message.scala
Attributes
- Deprecated
[Since version 0.22.0-M1]
Use {withPathInfo(Uri.Path)} instead- Source:
- Message.scala
Inherited methods
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
Decode the Media to the specified type
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
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
Attributes
- Inherited from:
- Media
- Source:
- Media.scala
Attributes
- Inherited from:
- Media
- Source:
- Media.scala
Attributes
- Inherited from:
- Media
- Source:
- Media.scala
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
Attributes
- f
predicate
- 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
Attributes
- Inherited from:
- Message
- Source:
- Message.scala
Attributes
- Inherited from:
- Message
- Source:
- Message.scala
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.
- Inherited from:
- Message
- Source:
- Message.scala
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
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
- Inherited from:
- Message
- Source:
- Message.scala
Attributes
- Inherited from:
- Message
- Source:
- Message.scala
Sets the entity body without affecting headers such as Transfer-Encoding
or Content-Length
. Most use cases are better served by Some.apply[Content-Length](_$5)))
caseNone=>
None
}
valheaders$1:Headers=cl.fold[Headers](hsBase)(((contentLength:Content-Length)=>hsBase.withContentLength(contentLength)))
valhttpVersion$1:HttpVersion@uncheckedVariance=Message.this.change$default$1
valattributes$1:Vault@uncheckedVariance=Message.this.change$default$4
Message.this.change(httpVersion$1,body=entity.body,headers=headers$1,attributes$1)
}">withEntity,
which uses an EntityEncoder to maintain the headers.
Sets the entity body without affecting headers such as Transfer-Encoding
or Content-Length
. Most use cases are better served by Some.apply[Content-Length](_$5)))
caseNone=>
None
}
valheaders$1:Headers=cl.fold[Headers](hsBase)(((contentLength:Content-Length)=>hsBase.withContentLength(contentLength)))
valhttpVersion$1:HttpVersion@uncheckedVariance=Message.this.change$default$1
valattributes$1:Vault@uncheckedVariance=Message.this.change$default$4
Message.this.change(httpVersion$1,body=entity.body,headers=headers$1,attributes$1)
}">withEntity,
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.
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
Replace the body of this message with a new body
Replace the body of this message with a new body
Attributes
- 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
- Inherited from:
- Some.apply[Content-Length](_$5))) caseNone=> None } valheaders$1:Headers=cl.fold[Headers](hsBase)(((contentLength:Content-Length)=>hsBase.withContentLength(contentLength))) valhttpVersion$1:HttpVersion@uncheckedVariance=Message.this.change$default$1 valattributes$1:Vault@uncheckedVariance=Message.this.change$default$4 Message.this.change(httpVersion$1,body=entity.body,headers=headers$1,attributes$1) }">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
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.
Attributes
- key
org.typelevel.vault.Key to remove
- 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
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala
Attributes
- Source:
- Message.scala