pekko/akka-docs/rst/java/http/routing-dsl/directives/header-directives/optionalHeaderValueByName.rst

15 lines
No EOL
558 B
ReStructuredText

.. _-optionalHeaderValueByName-java-:
optionalHeaderValueByName
=========================
Description
-----------
Optionally extracts the value of the HTTP request header with the given name.
The ``optionalHeaderValueByName`` directive is similar to the :ref:`-headerValueByName-java-` directive but always extracts
an ``Optional`` value instead of rejecting the request if no matching header could be found.
Example
-------
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/HeaderDirectivesExamplesTest.java#optionalHeaderValueByName