]> source.dussan.org Git - nextcloud-server.git/commitdiff
Set etag for capabilities endpoint 20722/head
authorDaniel Kesselberg <mail@danielkesselberg.de>
Wed, 29 Apr 2020 13:16:53 +0000 (15:16 +0200)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Wed, 29 Apr 2020 13:26:46 +0000 (15:26 +0200)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
core/Controller/OCSController.php
tests/Core/Controller/OCSControllerTest.php

index 7ed43fc6003f7401e3e92c0bf5a33155b1e8cd5d..057dee78676fa11808b943dbc57ab74041853a28 100644 (file)
@@ -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;
        }
 
        /**
index e860ff6d6411fa4cd1fcc6bae22cb8ac7ea66d78..c7cf601282bb2b56dcbb3634a55a83c0da0cbbb3 100644 (file)
@@ -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());
        }