diff --git a/plugins/request-uri-manipulations.rst b/plugins/request-uri-manipulations.rst index 76b2b4c..bd1117e 100644 --- a/plugins/request-uri-manipulations.rst +++ b/plugins/request-uri-manipulations.rst @@ -8,7 +8,7 @@ Request URI manipulations can be done thanks to several plugins: * ``AddPathPlugin``: Prefix the request path with a path, leaving the host information untouched. * ``BaseUriPlugin``: It's a combination of ``AddHostPlugin`` and ``AddPathPlugin``. -Each plugin use the ``UriInterface`` to build the base request:: +Each plugin uses the ``UriInterface`` to build the base request:: use Http\Discovery\HttpClientDiscovery; use Http\Discovery\UriFactoryDiscovery; @@ -24,3 +24,14 @@ Each plugin use the ``UriInterface`` to build the base request:: HttpClientDiscovery::find(), [$plugin] ); + +The ``AddPathPlugin`` will check if the path prefix is already present on the +URI. This will break for the edge case when the prefix is repeated. For example, +if ``https://example.com/api/api/foo`` is a valid URI on the server and the +configured prefix is ``/api``, the request to ``/api/foo`` is not rewritten. + +For further details, please see the phpdoc on the ``AddPathPlugin`` source code. + +No solution fits all use cases. This implementation works fine for the common +use cases. If you have a specific situation where this is not the right thing, +you can build a custom plugin that does exactly what you need.