Description
Description
Currently, when setting intercept_redirects
to true
, the WDT will display a "Redirection intercepted!" page when it encounters a 201, 301, 302, 303, 307 or 308 along with a Location
header.
The problem is that it doesn't filter the request format at this time, and as a consequence, WDT can even trigger an interception in an API context.
In a more concrete example, if you have the api-platform
package installed and POST a new resource with Accept: application/json+ld
, the application will return a 201 response with the freshly created resource Uri in the Location
header.
But for the WebDebugToolbarListener
, this is considered as a redirection and it should be intercepted.
Possible Solution
I suggest either adding 'html' === $request->getRequestFormat()
as an additionnal condition for the interception to be triggered, or rely on $response->isRedirection()
(>= 300, < 400) instead of $response->isRedirect()
(201, 301, 302, 303, 307, 308):
Thank you,
Ben