From 34d75aa9945124e311b191894075c21d65710a28 Mon Sep 17 00:00:00 2001 From: Damien Fa Date: Fri, 9 Oct 2020 17:55:57 +0200 Subject: [PATCH] Indicate to the Symfony Request attributes which Decoder has been used A Decoder may be applied to the Request content but the application (or a third bundle used by the application), this way we're able to know if a decoder has been applied (and which). --- EventListener/BodyListener.php | 1 + 1 file changed, 1 insertion(+) diff --git a/EventListener/BodyListener.php b/EventListener/BodyListener.php index cdf0e80b9..bacffde78 100644 --- a/EventListener/BodyListener.php +++ b/EventListener/BodyListener.php @@ -90,6 +90,7 @@ public function onKernelRequest(RequestEvent $event): void if (is_array($data)) { $request->request = new ParameterBag($data); $normalizeRequest = true; + $request->attributes->set('_fosrestbundle_decoder', get_class($decoder)); } else { throw new BadRequestHttpException('Invalid '.$format.' message received'); }