final class Headers extends AnyVal
- Alphabetic
- By Inheritance
- Headers
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
- def ++(those: Headers): Headers
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
- def add[H](h: H)(implicit arg0: Header[H, Recurring]): Headers
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
contains[A](implicit ev: Header[A, _]): Boolean
Returns true if there is at least one header by the specified name.
- def foreach(f: (Raw) ⇒ Unit): Unit
-
def
get(key: CIString): Option[NonEmptyList[Raw]]
Attempt to get headers by key from this collection of headers.
Attempt to get headers by key from this collection of headers.
- key
name of the headers to find.
- returns
a scala.Option possibly containing the resulting collection cats.data.NonEmptyList of org.http4s.Header.Raw.
-
def
get[A](implicit ev: Select[A]): Option[F[A]]
Attempt to get a (potentially repeating) header from this collection of headers.
Attempt to get a (potentially repeating) header from this collection of headers.
- returns
a scala.Option possibly containing the resulting (potentially repeating) header.
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
getWithWarnings[A](implicit ev: Select[A]): Option[Ior[NonEmptyList[ParseFailure], F[A]]]
Attempt to get a (potentially repeating) header and/or any parse errors from this collection of headers.
Attempt to get a (potentially repeating) header and/or any parse errors from this collection of headers.
- returns
a scala.Option possibly containing the resulting (potentially repeating) header and/or any parse errors.
- val headers: List[Raw]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mkString(separator: String, redactWhen: (CIString) ⇒ Boolean): String
Creates a string representation for a list of headers and redacts sensitive headers' values.
Creates a string representation for a list of headers and redacts sensitive headers' values.
- separator
the separator string
- redactWhen
the function for filtering out header values of sensitive headers
- returns
a string representation of the list of headers. The resulting string is constructed from the string representations of all headers separated by the string
separator
. Sensitive headers' values are redacted with theredactWhen
function.
-
def
mkString(start: String, separator: String, end: String, redactWhen: (CIString) ⇒ Boolean): String
Creates a string representation for a list of headers and redacts sensitive headers' values.
Creates a string representation for a list of headers and redacts sensitive headers' values.
- start
the starting string
- separator
the separator string
- end
the ending string
- redactWhen
the function for filtering out header values of sensitive headers
- returns
a string representation of the list of headers. The resulting string begins with the string
start
and ends with the stringend
. Inside, the string representations of all headers are separated by the stringseparator
. Sensitive headers' values are redacted with theredactWhen
function.
-
def
put(in: ToRaw*): Headers
Make a new collection adding the specified headers, replacing existing
Single
headers.Make a new collection adding the specified headers, replacing existing
Single
headers.- in
multiple heteregenous headers Header to append to the new collection, see Header.ToRaw
- returns
a new Headers containing the sum of the initial and input headers
- def redactSensitive(redactWhen: (CIString) ⇒ Boolean = Headers.SensitiveHeaders.contains): Headers
-
def
removePayloadHeaders: Headers
Removes the
Content-Length
,Content-Range
,Trailer
, andTransfer-Encoding
headers.Removes the
Content-Length
,Content-Range
,Trailer
, andTransfer-Encoding
headers.https://datatracker.ietf.org/doc/html/rfc7231#section-3.3
-
def
toString(): String
- Definition Classes
- Headers → Any
- def transform(f: (List[Raw]) ⇒ List[Raw]): Headers
-
def
withContentLength(contentLength: Content-Length): Headers
Puts a
Content-Length
header, replacing any existing.Puts a
Content-Length
header, replacing any existing. Removes any existingchunked
value from theTransfer-Encoding
header. It is critical that the supplied content length accurately describe the length of the body stream.scala> import org.http4s.headers._ scala> val chunked = Headers( | `Transfer-Encoding`(TransferCoding.chunked), | `Content-Type`(MediaType.text.plain)) scala> chunked.withContentLength(`Content-Length`.unsafeFromLong(1024)) res0: Headers = Headers(Content-Length: 1024, Content-Type: text/plain) scala> val chunkedGzipped = Headers( | `Transfer-Encoding`(TransferCoding.chunked, TransferCoding.gzip), | `Content-Type`(MediaType.text.plain)) scala> chunkedGzipped.withContentLength(`Content-Length`.unsafeFromLong(1024)) res1: Headers = Headers(Content-Length: 1024, Transfer-Encoding: gzip, Content-Type: text/plain) scala> val const = Headers( | `Content-Length`(2048), | `Content-Type`(MediaType.text.plain)) scala> const.withContentLength(`Content-Length`.unsafeFromLong(1024)) res1: Headers = Headers(Content-Length: 1024, Content-Type: text/plain)