Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c8ce65d

Browse filesBrowse files
committed
Changes after @Simperfit review
1 parent b3984d0 commit c8ce65d
Copy full SHA for c8ce65d

File tree

1 file changed

+8
-62
lines changed
Filter options

1 file changed

+8
-62
lines changed

‎routing/redirect_in_config.rst

Copy file name to clipboardExpand all lines: routing/redirect_in_config.rst
+8-62Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -159,72 +159,18 @@ action:
159159
Redirecting POST/PUT calls
160160
--------------------------
161161

162-
As default behaviour of both methods mentioned above results in sending
162+
As a default behaviour of both methods mentioned above results in sending
163163
response with ``301`` or ``302`` HTTP status codes, the following call will
164-
be made with use of HTTP request method. But it some scenarios it is
165-
expected or required that following call will be made with the same HTTP
164+
be made with use of HTTP request method. But in some scenarios it's either
165+
expected or required that the following call will be made with the same HTTP
166166
method, i.e. when initial call was ``POST`` one, then following one should
167167
be also ``POST`` not ``GET``. In order to achieve this both
168168
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction`
169169
and
170170
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction`
171-
are accepting aditional switch called ``keepRequestMethod``:
171+
are accepting aditional switch called ``keepRequestMethod``.
172172

173-
.. configuration-block::
174-
175-
.. code-block:: yaml
176-
177-
# config/routes.yaml
178-
179-
# ...
180-
181-
admin:
182-
path: /webhooks/foo
183-
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
184-
defaults:
185-
route: foo_webhook_handler
186-
permanent: true
187-
keepRequestMethod: true
188-
189-
.. code-block:: xml
190-
191-
<!-- config/routes.xml -->
192-
<?xml version="1.0" encoding="UTF-8" ?>
193-
<routes xmlns="http://symfony.com/schema/routing"
194-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
195-
xsi:schemaLocation="http://symfony.com/schema/routing
196-
http://symfony.com/schema/routing/routing-1.0.xsd">
197-
198-
<!-- ... -->
199-
200-
<route id="admin" path="/webhooks/foo"> ``
201-
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction</default>
202-
<default key="route">foo_webhook_handler</default>
203-
<default key="permanent">true</default>
204-
<default key="keepRequestMethod">true</default>
205-
</route>
206-
</routes>
207-
208-
.. code-block:: php
209-
210-
// config/routes.php
211-
use Symfony\Component\Routing\RouteCollection;
212-
use Symfony\Component\Routing\Route;
213-
214-
$collection = new RouteCollection();
215-
// ...
216-
217-
$collection->add('admin', new Route('/webhooks/foo', array(
218-
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction',
219-
'route' => 'foo_webhook_handler',
220-
'permanent' => true,
221-
'keepRequestMethod' => true
222-
)));
223-
224-
return $collection;
225-
226-
Switching ``keepRequestMethod`` switch to ``true`` will result in sending
227-
response with either ``307`` (when ``permament`` switch is set to false) or
228-
``308`` (with ``permament`` being true) HTTP status code which will tell that
229-
HTTP request should be repeated with both request method and body being
230-
unchanged.
173+
When ``keepRequestMethod`` is set to ``true`` with either ``permanent`` set to
174+
``false`` which will lead to a ``307`` response or ``308`` with
175+
``permanent`` being ``true``. Theses codes will give information in the HTTP
176+
request that the method should be repeated without altering the body.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.