mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-27 20:11:34 +03:00
Fixed mercure hub URL returned by MercureInfoAction
This commit is contained in:
parent
72d8edf4ff
commit
b858d79b9e
2 changed files with 4 additions and 2 deletions
|
@ -13,6 +13,8 @@ use Shlinkio\Shlink\Common\Mercure\JwtProviderInterface;
|
||||||
use Shlinkio\Shlink\Rest\Exception\MercureException;
|
use Shlinkio\Shlink\Rest\Exception\MercureException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
|
use function sprintf;
|
||||||
|
|
||||||
class MercureInfoAction extends AbstractRestAction
|
class MercureInfoAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/mercure-info';
|
protected const ROUTE_PATH = '/mercure-info';
|
||||||
|
@ -48,7 +50,7 @@ class MercureInfoAction extends AbstractRestAction
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
'mercureHubUrl' => $hubUrl,
|
'mercureHubUrl' => sprintf('%s/.well-known/mercure', $hubUrl),
|
||||||
'token' => $jwt,
|
'token' => $jwt,
|
||||||
'jwtExpiration' => $expiresAt->toAtomString(),
|
'jwtExpiration' => $expiresAt->toAtomString(),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class MercureInfoActionTest extends TestCase
|
||||||
$payload = $resp->getPayload();
|
$payload = $resp->getPayload();
|
||||||
|
|
||||||
$this->assertArrayHasKey('mercureHubUrl', $payload);
|
$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('token', $payload);
|
||||||
$this->assertArrayHasKey('jwtExpiration', $payload);
|
$this->assertArrayHasKey('jwtExpiration', $payload);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
|
Loading…
Add table
Reference in a new issue