Fixed mercure hub URL returned by MercureInfoAction

This commit is contained in:
Alejandro Celaya 2020-04-12 17:50:09 +02:00
parent 72d8edf4ff
commit b858d79b9e
2 changed files with 4 additions and 2 deletions

View file

@ -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(),
]);

View file

@ -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(