pekko/akka-docs-dev/rst/scala/http/routing-dsl/directives/route-directives/reject.rst
Konrad Malawski 87f4447b23 =doc #18104 fixes typo which made includecode2 not work in many places
Note that some of the files don't exist, fixing this very soon.
2015-09-16 23:50:35 +02:00

33 lines
No EOL
998 B
ReStructuredText

.. _-reject-:
reject
======
Explicitly rejects the request optionally using the given rejection(s).
Signature
---------
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/RouteDirectives.scala
:snippet: reject
Description
-----------
``reject`` uses the given rejection instances (which might be the empty ``Seq``) to construct a ``Route`` which simply
calls ``requestContext.reject``. See the chapter on :ref:`Rejections` for more information on what this means.
After the request has been rejected at the respective point it will continue to flow through the routing structure in
the search for a route that is able to complete it.
The explicit ``reject`` directive is used mostly when building :ref:`Custom Directives`, e.g. inside of a ``flatMap``
modifier for "filtering out" certain cases.
Example
-------
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
:snippet: reject-examples