optionalHeaderValue
Traverses the list of request headers with the specified function and extracts the first value the function returns as
Some(value)
.
Signature
def optionalHeaderValue[T](f: HttpHeader ⇒ Option[T]): Directive1[Option[T]]
Description
The optionalHeaderValue
directive is similar to the headerValue
directive but always extracts an Option
value instead of rejecting the request if no matching header could be found.