diff --git a/src/Hydra/State/HydraLinkProcessor.php b/src/Hydra/State/HydraLinkProcessor.php index 3faff4f7aaf..8a07c56d6c5 100644 --- a/src/Hydra/State/HydraLinkProcessor.php +++ b/src/Hydra/State/HydraLinkProcessor.php @@ -45,7 +45,7 @@ public function process(mixed $data, Operation $operation, array $uriVariables = return $this->decorated->process($data, $operation, $uriVariables, $context); } - $apiDocUrl = $this->urlGenerator->generate('api_doc', ['_format' => 'jsonld'], UrlGeneratorInterface::ABS_URL); + $apiDocUrl = $this->urlGenerator->generate('api_doc', ['_format' => 'jsonld'], UrlGeneratorInterface::ABS_PATH); $linkProvider = $request->attributes->get('_api_platform_links') ?? new GenericLinkProvider(); foreach ($operation->getLinks() ?? [] as $link) { diff --git a/src/Hydra/Tests/State/HydraLinkProcessorTest.php b/src/Hydra/Tests/State/HydraLinkProcessorTest.php index b5ce10a1009..68de343e20e 100644 --- a/src/Hydra/Tests/State/HydraLinkProcessorTest.php +++ b/src/Hydra/Tests/State/HydraLinkProcessorTest.php @@ -42,7 +42,12 @@ public function testProcess(): void $context = ['request' => $request]; $decorated = $this->createMock(ProcessorInterface::class); $urlGenerator = $this->createMock(UrlGeneratorInterface::class); - $urlGenerator->expects($this->once())->method('generate')->with('api_doc', ['_format' => 'jsonld'], UrlGeneratorInterface::ABS_URL)->willReturn('/docs'); + $urlGenerator + ->expects($this->once()) + ->method('generate') + ->with('api_doc', ['_format' => 'jsonld'], UrlGeneratorInterface::ABS_PATH) + ->willReturn('/docs') + ; (new HydraLinkProcessor($decorated, $urlGenerator))->process($data, $operation, [], $context); } }