Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc8ce65d

Browse files
committed
Changes after@Simperfit review
1 parentb3984d0 commitc8ce65d

File tree

1 file changed

+8
-62
lines changed

1 file changed

+8
-62
lines changed

‎routing/redirect_in_config.rst‎

Lines 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+
Asadefault 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. Butit 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. Butin some scenarios it's either
165+
expected or required thatthefollowing 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-
<routesxmlns="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-
<routeid="admin"path="/webhooks/foo"> ``
201-
<defaultkey="_controller">Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction</default>
202-
<defaultkey="route">foo_webhook_handler</default>
203-
<defaultkey="permanent">true</default>
204-
<defaultkey="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)

[8]ページ先頭

©2009-2025 Movatter.jp