From b858d79b9eaacc145eadf70797daa8c72a6efba1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 12 Apr 2020 17:50:09 +0200 Subject: [PATCH] Fixed mercure hub URL returned by MercureInfoAction --- module/Rest/src/Action/MercureInfoAction.php | 4 +++- module/Rest/test/Action/MercureInfoActionTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/Rest/src/Action/MercureInfoAction.php b/module/Rest/src/Action/MercureInfoAction.php index 906a0b45..73526d9f 100644 --- a/module/Rest/src/Action/MercureInfoAction.php +++ b/module/Rest/src/Action/MercureInfoAction.php @@ -13,6 +13,8 @@ use Shlinkio\Shlink\Common\Mercure\JwtProviderInterface; use Shlinkio\Shlink\Rest\Exception\MercureException; use Throwable; +use function sprintf; + class MercureInfoAction extends AbstractRestAction { protected const ROUTE_PATH = '/mercure-info'; @@ -48,7 +50,7 @@ class MercureInfoAction extends AbstractRestAction } return new JsonResponse([ - 'mercureHubUrl' => $hubUrl, + 'mercureHubUrl' => sprintf('%s/.well-known/mercure', $hubUrl), 'token' => $jwt, 'jwtExpiration' => $expiresAt->toAtomString(), ]); diff --git a/module/Rest/test/Action/MercureInfoActionTest.php b/module/Rest/test/Action/MercureInfoActionTest.php index f9489c99..5cb5e41b 100644 --- a/module/Rest/test/Action/MercureInfoActionTest.php +++ b/module/Rest/test/Action/MercureInfoActionTest.php @@ -89,7 +89,7 @@ class MercureInfoActionTest extends TestCase $payload = $resp->getPayload(); $this->assertArrayHasKey('mercureHubUrl', $payload); - $this->assertEquals('http://foobar.com', $payload['mercureHubUrl']); + $this->assertEquals('http://foobar.com/.well-known/mercure', $payload['mercureHubUrl']); $this->assertArrayHasKey('token', $payload); $this->assertArrayHasKey('jwtExpiration', $payload); $this->assertEquals(