Skip to content

Commit 9e90c03

Browse files
committed
fix: content-type guessing
1 parent 732c5f9 commit 9e90c03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Serializer/ArgumentResolver/UserInputResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
5454
$context = array_merge($attribute->serializationContext, [
5555
DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true,
5656
]);
57-
$format = $attribute->format ?? $request->attributes->get('_format', 'json');
57+
$format = $attribute->format ?? $request->getContentType() ?? 'json';
5858

5959
try {
60-
$input = $this->serializer->deserialize(data: $request->getContent(), type: $argument->getType(), format: $format, context: $context);
60+
$input = $this->serializer->deserialize($request->getContent(), $argument->getType(), $format, $context);
6161
} catch (PartialDenormalizationException $e) {
6262
if (null === $this->validator) {
6363
throw new UnprocessableEntityHttpException(message: $e->getMessage(), previous: $e);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy