Skip to content

Commit

Permalink
Merge pull request #20722 from nextcloud/enh/20693/etag-capabilities
Browse files Browse the repository at this point in the history
Set etag for capabilities endpoint
  • Loading branch information
MorrisJobke authored May 4, 2020
2 parents e102264 + df669a2 commit a93d182
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/Controller/OCSController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ public function getCapabilities() {
$result['capabilities'] = $this->capabilitiesManager->getCapabilities(true);
}

return new DataResponse($result);
$response = new DataResponse($result);
$response->setETag(md5(json_encode($result)));
return $response;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Core/Controller/OCSControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public function testGetCapabilities() {
$result['capabilities'] = $capabilities;

$expected = new DataResponse($result);
$expected->setETag(md5(json_encode($result)));
$this->assertEquals($expected, $this->controller->getCapabilities());
}

Expand Down Expand Up @@ -146,6 +147,7 @@ public function testGetCapabilitiesPublic() {
$result['capabilities'] = $capabilities;

$expected = new DataResponse($result);
$expected->setETag(md5(json_encode($result)));
$this->assertEquals($expected, $this->controller->getCapabilities());
}

Expand Down

0 comments on commit a93d182

Please sign in to comment.