summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-01 14:43:47 +0200
committerGitHub <noreply@github.com>2017-08-01 14:43:47 +0200
commit84c22fdeef6986f9038d8563937cc234751d5147 (patch)
treee56de337cebc2f069c5282909a89a5de29a29df4 /lib/public
parent6010c4f267f6b59e0dfd620dc928227f75dae9d1 (diff)
parentf22ab3e665124e79427f51049fea0f937b66cdbb (diff)
downloadnextcloud-server-84c22fdeef6986f9038d8563937cc234751d5147.tar.gz
nextcloud-server-84c22fdeef6986f9038d8563937cc234751d5147.zip
Merge pull request #5907 from nextcloud/add-metadata-to-throttle-call
Add metadata to \OCP\AppFramework\Http\Response::throttle
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/AppFramework/Http/Response.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index c3b81d2baf7..94f09a55737 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -83,6 +83,8 @@ class Response {
/** @var bool */
private $throttled = false;
+ /** @var array */
+ private $throttleMetadata = [];
/**
* Caches the response
@@ -328,10 +330,22 @@ class Response {
* Marks the response as to throttle. Will be throttled when the
* @BruteForceProtection annotation is added.
*
+ * @param array $metadata
* @since 12.0.0
*/
- public function throttle() {
+ public function throttle(array $metadata = []) {
$this->throttled = true;
+ $this->throttleMetadata = $metadata;
+ }
+
+ /**
+ * Returns the throttle metadata, defaults to empty array
+ *
+ * @return array
+ * @since 13.0.0
+ */
+ public function getThrottleMetadata() {
+ return $this->throttleMetadata;
}
/**