Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set etag for capabilities endpoint
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Apr 29, 2020
commit df669a29360a3ec69e87829f15571f261b39280b
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