2015-05-11 23:05:18 +02:00
|
|
|
.. _-rejectEmptyResponse-:
|
|
|
|
|
|
|
|
|
|
rejectEmptyResponse
|
|
|
|
|
===================
|
|
|
|
|
|
|
|
|
|
Replaces a response with no content with an empty rejection.
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
|
|
|
|
.. includecode2:: /../../akka-http-scala/src/main/scala/akka/http/scaladsl/server/directives/MiscDirectives.scala
|
|
|
|
|
:snippet: rejectEmptyResponse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
The ``rejectEmptyResponse`` directive is mostly used with marshalling ``Option[T]`` instances. The value ``None`` is
|
|
|
|
|
usually marshalled to an empty but successful result. In many cases ``None`` should instead be handled as
|
|
|
|
|
``404 Not Found`` which is the effect of using ``rejectEmptyResponse``.
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
2015-05-21 17:34:46 +02:00
|
|
|
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/MiscDirectivesExamplesSpec.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: rejectEmptyResponse-example
|