Skip to content

Commit 81dc6bc

Browse files
committed
fix(symfony): allow route default _format configuration
1 parent 767fbdd commit 81dc6bc

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Symfony/Routing/ApiLoader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ public function load(mixed $data, ?string $type = null): RouteCollection
9090
$path,
9191
[
9292
'_controller' => $controller ?? 'api_platform.action.placeholder',
93-
'_format' => null,
9493
'_stateless' => $operation->getStateless(),
9594
'_api_resource_class' => $resourceClass,
9695
'_api_operation_name' => $operationName,
97-
] + ($operation->getDefaults() ?? []),
96+
] + ($operation->getDefaults() ?? []) + ['_format' => null],
9897
$operation->getRequirements() ?? [],
9998
$operation->getOptions() ?? [],
10099
$operation->getHost() ?? '',

tests/Symfony/Routing/ApiLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ private function getRoute(string $path, string $controller, ?bool $stateless, st
321321
$path,
322322
[
323323
'_controller' => $controller,
324-
'_format' => null,
324+
'_format' => $extraDefaults['_format'] ?? null,
325325
'_stateless' => $stateless,
326326
'_api_resource_class' => $resourceClass,
327327
'_api_operation_name' => $operationName,

0 commit comments

Comments
 (0)