summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2020-04-29 15:16:53 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2020-04-29 15:26:46 +0200
commitdf669a29360a3ec69e87829f15571f261b39280b (patch)
treea91f28cd4f5140a7baf47b5cbb1051d83a62b6c0
parentb219eadb8f3f459f2c71e937dfd3542f0792da8e (diff)
downloadnextcloud-server-df669a29360a3ec69e87829f15571f261b39280b.tar.gz
nextcloud-server-df669a29360a3ec69e87829f15571f261b39280b.zip
Set etag for capabilities endpoint
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--core/Controller/OCSController.php4
-rw-r--r--tests/Core/Controller/OCSControllerTest.php2
2 files changed, 5 insertions, 1 deletions
diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php
index 7ed43fc6003..057dee78676 100644
--- a/core/Controller/OCSController.php
+++ b/core/Controller/OCSController.php
@@ -108,7 +108,9 @@ class OCSController extends \OCP\AppFramework\OCSController {
$result['capabilities'] = $this->capabilitiesManager->getCapabilities(true);
}
- return new DataResponse($result);
+ $response = new DataResponse($result);
+ $response->setETag(md5(json_encode($result)));
+ return $response;
}
/**
diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php
index e860ff6d641..c7cf601282b 100644
--- a/tests/Core/Controller/OCSControllerTest.php
+++ b/tests/Core/Controller/OCSControllerTest.php
@@ -113,6 +113,7 @@ class OCSControllerTest extends TestCase {
$result['capabilities'] = $capabilities;
$expected = new DataResponse($result);
+ $expected->setETag(md5(json_encode($result)));
$this->assertEquals($expected, $this->controller->getCapabilities());
}
@@ -146,6 +147,7 @@ class OCSControllerTest extends TestCase {
$result['capabilities'] = $capabilities;
$expected = new DataResponse($result);
+ $expected->setETag(md5(json_encode($result)));
$this->assertEquals($expected, $this->controller->getCapabilities());
}