2015-05-11 23:05:18 +02:00
|
|
|
.. _-method-:
|
|
|
|
|
|
|
|
|
|
method
|
|
|
|
|
======
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
2015-06-19 15:35:24 +02:00
|
|
|
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/MethodDirectives.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: method
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
2015-10-09 15:19:36 +02:00
|
|
|
Matches HTTP requests based on their method.
|
2015-05-11 23:05:18 +02:00
|
|
|
|
|
|
|
|
This directive filters the incoming request by its HTTP method. Only requests with
|
|
|
|
|
the specified method are passed on to the inner route. All others are rejected with a
|
|
|
|
|
``MethodRejection``, which is translated into a ``405 Method Not Allowed`` response
|
|
|
|
|
by the default :ref:`RejectionHandler <The RejectionHandler>`.
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
2015-05-21 17:34:46 +02:00
|
|
|
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/MethodDirectivesExamplesSpec.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: method-example
|