From d63a30d28bcdb3963d7a1438573e94746b71b9b3 Mon Sep 17 00:00:00 2001 From: yoann Date: Wed, 17 May 2023 08:41:25 -1000 Subject: [PATCH] feat: enable new content type - make symfony controller accept application/pdf and image/png formats --- .../SymfonyBundle-php/Controller/Controller.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php index 559f3bd5a4bc..bd2cae073e51 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php @@ -211,6 +211,14 @@ protected function getOutputFormat(string $accept, array $produced): ?string return 'application/xml'; } + if (in_array('application/pdf', $accept) && in_array('application/pdf', $produced)) { + return 'application/pdf'; + } + + if (in_array('image/png', $accept) && in_array('image/png', $produced)) { + return 'image/png'; + } + // If we reach this point, we don't have a common ground between server and client return null; }