Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 2c74eb9

Browse files
committed
Fix Symfony 6.2 deprecation
Request::getContentType is deprecated since Symfony 6.2
1 parent 0fa2a21 commit 2c74eb9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/JsonRequestTransformerListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function onKernelRequest(RequestEvent $event): void
4444

4545
private function isJsonRequest(Request $request): bool
4646
{
47-
return 'json' === $request->getContentType();
47+
// Request::getContentType() is deprecated since Symfony 6.2
48+
return 'json' === (method_exists($request, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType());
4849
}
4950

5051
private function transformJsonBody(Request $request): bool

0 commit comments

Comments
 (0)