aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/Controller/NavigationController.php12
-rw-r--r--tests/Core/Controller/NavigationControllerTest.php31
2 files changed, 2 insertions, 41 deletions
diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php
index de72e412945..5fc929b4eb4 100644
--- a/core/Controller/NavigationController.php
+++ b/core/Controller/NavigationController.php
@@ -47,12 +47,8 @@ class NavigationController extends OCSController {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
$navigation = array_values($navigation);
- $etag = $this->generateETag($navigation);
- if ($this->request->getHeader('If-None-Match') === $etag) {
- return new DataResponse([], Http::STATUS_NOT_MODIFIED);
- }
$response = new DataResponse($navigation);
- $response->setETag($etag);
+ $response->setETag($this->generateETag($navigation));
return $response;
}
@@ -74,12 +70,8 @@ class NavigationController extends OCSController {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
$navigation = array_values($navigation);
- $etag = $this->generateETag($navigation);
- if ($this->request->getHeader('If-None-Match') === $etag) {
- return new DataResponse([], Http::STATUS_NOT_MODIFIED);
- }
$response = new DataResponse($navigation);
- $response->setETag($etag);
+ $response->setETag($this->generateETag($navigation));
return $response;
}
diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php
index 7ebfbc139cd..acbee5a72f0 100644
--- a/tests/Core/Controller/NavigationControllerTest.php
+++ b/tests/Core/Controller/NavigationControllerTest.php
@@ -7,7 +7,6 @@
namespace Tests\Core\Controller;
use OC\Core\Controller\NavigationController;
-use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\INavigationManager;
use OCP\IRequest;
@@ -103,34 +102,4 @@ class NavigationControllerTest extends TestCase {
$this->assertEquals('/core/img/settings.svg', $actual->getData()[0]['icon']);
}
}
-
- public function testGetAppNavigationEtagMatch(): void {
- $navigation = [ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
- $this->request->expects($this->once())
- ->method('getHeader')
- ->with('If-None-Match')
- ->willReturn(md5(json_encode($navigation)));
- $this->navigationManager->expects($this->once())
- ->method('getAll')
- ->with('link')
- ->willReturn($navigation);
- $actual = $this->controller->getAppsNavigation();
- $this->assertInstanceOf(DataResponse::class, $actual);
- $this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus());
- }
-
- public function testGetSettingsNavigationEtagMatch(): void {
- $navigation = [ ['id' => 'logout', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
- $this->request->expects($this->once())
- ->method('getHeader')
- ->with('If-None-Match')
- ->willReturn(md5(json_encode([ ['id' => 'logout', 'href' => 'logout', 'icon' => 'icon' ] ])));
- $this->navigationManager->expects($this->once())
- ->method('getAll')
- ->with('settings')
- ->willReturn($navigation);
- $actual = $this->controller->getSettingsNavigation();
- $this->assertInstanceOf(DataResponse::class, $actual);
- $this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus());
- }
}