object HeaderDirectives extends HeaderDirectives
- Source
- HeaderDirectives.scala
- Grouped
- Alphabetic
- By Inheritance
- HeaderDirectives
- HeaderDirectives
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Header directives
-
def
checkSameOrigin(allowed: Default): Directive0
Checks that request comes from the same origin.
Checks that request comes from the same origin. Extracts the Origin header value and verifies that allowed range contains the obtained value. In the case of absent of the Origin header rejects with MissingHeaderRejection. If the origin value is not in the allowed range rejects with an InvalidOriginRejection and StatusCodes.Forbidden status.
- Definition Classes
- HeaderDirectives
-
def
headerValue[T](f: (HttpHeader) ⇒ Option[T]): Directive1[T]
Extracts an HTTP header value using the given function.
Extracts an HTTP header value using the given function. If the function result is undefined for all headers the request is rejected with an empty rejection set. If the given function throws an exception the request is rejected with a akka.http.scaladsl.server.MalformedHeaderRejection.
- Definition Classes
- HeaderDirectives
-
def
headerValueByName(headerName: String): Directive1[String]
Extracts the value of the HTTP request header with the given name.
Extracts the value of the HTTP request header with the given name. If no header with a matching name is found the request is rejected with a akka.http.scaladsl.server.MissingHeaderRejection.
- Definition Classes
- HeaderDirectives
-
def
headerValueByName(headerName: Symbol): Directive1[String]
Extracts the value of the first HTTP request header with the given name.
Extracts the value of the first HTTP request header with the given name. If no header with a matching name is found the request is rejected with a akka.http.scaladsl.server.MissingHeaderRejection.
- Definition Classes
- HeaderDirectives
-
def
headerValueByType[T](magnet: HeaderMagnet[T]): Directive1[T]
Extracts the first HTTP request header of the given type.
Extracts the first HTTP request header of the given type. If no header with a matching type is found the request is rejected with a akka.http.scaladsl.server.MissingHeaderRejection.
Custom headers will only be matched by this directive if they extend ModeledCustomHeader and provide a companion extending ModeledCustomHeaderCompanion.
- Definition Classes
- HeaderDirectives
-
def
headerValuePF[T](pf: PartialFunction[HttpHeader, T]): Directive1[T]
Extracts an HTTP header value using the given partial function.
Extracts an HTTP header value using the given partial function. If the function is undefined for all headers the request is rejected with an empty rejection set.
- Definition Classes
- HeaderDirectives
-
def
optionalHeaderValue[T](f: (HttpHeader) ⇒ Option[T]): Directive1[Option[T]]
Extracts an optional HTTP header value using the given function.
Extracts an optional HTTP header value using the given function. If the given function throws an exception the request is rejected with a akka.http.scaladsl.server.MalformedHeaderRejection.
- Definition Classes
- HeaderDirectives
-
def
optionalHeaderValueByName(headerName: String): Directive1[Option[String]]
Extracts the value of the optional HTTP request header with the given name.
Extracts the value of the optional HTTP request header with the given name.
- Definition Classes
- HeaderDirectives
-
def
optionalHeaderValueByName(headerName: Symbol): Directive1[Option[String]]
Extracts the value of the optional HTTP request header with the given name.
Extracts the value of the optional HTTP request header with the given name.
- Definition Classes
- HeaderDirectives
-
def
optionalHeaderValueByType[T <: HttpHeader](magnet: HeaderMagnet[T]): Directive1[Option[T]]
Extract the header value of the optional HTTP request header with the given type.
Extract the header value of the optional HTTP request header with the given type.
Custom headers will only be matched by this directive if they extend ModeledCustomHeader and provide a companion extending ModeledCustomHeaderCompanion.
- Definition Classes
- HeaderDirectives
-
def
optionalHeaderValuePF[T](pf: PartialFunction[HttpHeader, T]): Directive1[Option[T]]
Extracts an optional HTTP header value using the given partial function.
Extracts an optional HTTP header value using the given partial function. If the given function throws an exception the request is rejected with a akka.http.scaladsl.server.MalformedHeaderRejection.
- Definition Classes
- HeaderDirectives