Skip to content

Commit 9a5b8d0

Browse files
smokriskesselb
authored andcommitted
fix(settings): define a 'heartbeat' route, so SecurityHeaders can handle redirected root
Signed-off-by: Steve Mokris <steve@kosada.com>
1 parent 7fc4691 commit 9a5b8d0

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

core/routes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@
4040
// Routing
4141
$this->create('core_ajax_update', '/core/ajax/update.php')
4242
->actionInclude('core/ajax/update.php');
43+
44+
$this->create('heartbeat', '/heartbeat')->get();

tests/lib/Route/RouterTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939
* @package Test\Route
4040
*/
4141
class RouterTest extends TestCase {
42-
public function testGenerateConsecutively(): void {
42+
/** @var Router */
43+
private $router;
44+
protected function setUp(): void {
45+
parent::setUp();
4346
/** @var LoggerInterface $logger */
4447
$logger = $this->createMock(LoggerInterface::class);
4548
$logger->method('info')
@@ -48,20 +51,27 @@ function (string $message, array $data) {
4851
$this->fail('Unexpected info log: '.(string)($data['exception'] ?? $message));
4952
}
5053
);
51-
$router = new Router(
54+
$this->router = new Router(
5255
$logger,
5356
$this->createMock(IRequest::class),
5457
$this->createMock(IConfig::class),
5558
$this->createMock(IEventLogger::class),
5659
$this->createMock(ContainerInterface::class),
5760
);
61+
}
62+
63+
public function testHeartbeat(): void {
64+
$this->assertEquals('/index.php/heartbeat', $this->router->generate('heartbeat'));
65+
}
66+
67+
public function testGenerateConsecutively(): void {
5868

59-
$this->assertEquals('/index.php/apps/files/', $router->generate('files.view.index'));
69+
$this->assertEquals('/index.php/apps/files/', $this->router->generate('files.view.index'));
6070

6171
// the OCS route is the prefixed one for the AppFramework - see /ocs/v1.php for routing details
62-
$this->assertEquals('/index.php/ocsapp/apps/dav/api/v1/direct', $router->generate('ocs.dav.direct.getUrl'));
72+
$this->assertEquals('/index.php/ocsapp/apps/dav/api/v1/direct', $this->router->generate('ocs.dav.direct.getUrl'));
6373

6474
// test caching
65-
$this->assertEquals('/index.php/apps/files/', $router->generate('files.view.index'));
75+
$this->assertEquals('/index.php/apps/files/', $this->router->generate('files.view.index'));
6676
}
6777
}

0 commit comments

Comments
 (0)