Skip to content

Commit d2ee81f

Browse files
dbuNyholm
authored andcommitted
Update request-uri-manipulations.rst (#245)
1 parent 82bea5a commit d2ee81f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

plugins/request-uri-manipulations.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Request URI manipulations can be done thanks to several plugins:
88
* ``AddPathPlugin``: Prefix the request path with a path, leaving the host information untouched.
99
* ``BaseUriPlugin``: It's a combination of ``AddHostPlugin`` and ``AddPathPlugin``.
1010

11-
Each plugin use the ``UriInterface`` to build the base request::
11+
Each plugin uses the ``UriInterface`` to build the base request::
1212

1313
use Http\Discovery\HttpClientDiscovery;
1414
use Http\Discovery\UriFactoryDiscovery;
@@ -24,3 +24,14 @@ Each plugin use the ``UriInterface`` to build the base request::
2424
HttpClientDiscovery::find(),
2525
[$plugin]
2626
);
27+
28+
The ``AddPathPlugin`` will check if the path prefix is already present on the
29+
URI. This will break for the edge case when the prefix is repeated. For example,
30+
if ``https://example.com/api/api/foo`` is a valid URI on the server and the
31+
configured prefix is ``/api``, the request to ``/api/foo`` is not rewritten.
32+
33+
For further details, please see the phpdoc on the ``AddPathPlugin`` source code.
34+
35+
No solution fits all use cases. This implementation works fine for the common
36+
use cases. If you have a specific situation where this is not the right thing,
37+
you can build a custom plugin that does exactly what you need.

0 commit comments

Comments
 (0)