@@ -29,6 +29,15 @@ Initiate the redirect plugin as follows::
29
29
follow redirects instead of going to the right end point directly makes your application slower
30
30
and increases the load on both server and client.
31
31
32
+ .. note ::
33
+
34
+ Depending on the status code, redirecting should change POST/PUT requests to GET requests. This
35
+ plugin implements this behaviour - except if you set the ``strict `` option to true, as explained
36
+ below. It removes the request body if the method changes, see ``stream_factory `` below.
37
+
38
+ To understand the exact semantics of which HTTP status changes the method and which not, have a
39
+ look at the configuration in the source code of the RedirectPlugin class.
40
+
32
41
Options
33
42
-------
34
43
@@ -45,6 +54,16 @@ false, a status of 300 will raise the ``Http\Client\Common\Exception\MultipleRed
45
54
46
55
``strict ``: bool (default: false)
47
56
48
- When set to ``true ``, 300, 301 and 302 status codes will not modify original request's method and
49
- body on consecutive requests. E. g. POST redirect requests are sent as POST requests instead of
57
+ When set to ``true ``, 300, 301 and 302 status codes will not modify original request's method and
58
+ body on consecutive requests. E. g. POST redirect requests are sent as POST requests instead of
50
59
POST redirect requests are sent as GET requests.
60
+
61
+ ``stream_factory ``: StreamFactoryInterface (default: auto discovered)
62
+
63
+ The PSR-17 stream factory is used to create an empty stream for removing the body of the request on
64
+ redirection. To keep the body on all redirections, set ``stream_factory `` to null.
65
+ The stream factory is discovered if either ``php-http/discovery `` is installed and provides a
66
+ factory, or ``nyholm/psr7 `` or a new enough version of ``guzzlehttp/psr7 `` are installed. If you
67
+ only have other implementations, you need to provide the factory in ``stream_factory ``.
68
+
69
+ If no factory is found, the redirect plugin does not remove the body on redirection.
0 commit comments