Representation of an incoming HTTP message
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.
- Value Params
- 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
Type members
Value members
Concrete methods
Add a Cookie header for the provided org.http4s.headers.Cookie
Add a Cookie header for the provided org.http4s.headers.Cookie
cURL representation of the request.
cURL representation of the request.
Supported cURL-Parameters are: -X, -H
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.
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.
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.
Whether the Request was received over a secure medium
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=v3 | 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.
Deprecated methods
Inherited methods
Decode the Media to the specified type
Decode the Media to the specified type
- Type Params
- T
type of the result
- Value Params
- decoder
EntityDecoder used to decode the Media
- Returns
the effect which will generate the
DecodeResult[T]
- Inherited from
- Media
Keep headers that satisfy the predicate
Keep headers that satisfy the predicate
- Value Params
- f
predicate
- Returns
a new message object which has only headers that satisfy the predicate
- Inherited from
- Message
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
- Inherited from
- Message
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.
- Inherited from
- Message
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 Params
- A
type of the value to store
- Value Params
- key
io.chrisdavenport.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
Sets the entity body without affecting headers such as Transfer-Encoding
or Content-Length
. Most use cases are better served by 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 withEntity,
which uses an EntityEncoder to maintain the headers.
- Inherited from
- Message
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.
- Inherited from
- Message
Replace the body of this message with a new body
Replace the body of this message with a new body
- Type Params
- T
type of the Body
- Value Params
- 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
- Message
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 Params
- key
io.chrisdavenport.vault.Key to remove
- Returns
a new message object without the key
- Inherited from
- Message