]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ApiConfigTest.php
Added configurable API throttling, Handled API errors standardly
[bookstack] / tests / Api / ApiConfigTest.php
index d9367741f55d02672d7a2424ac5040d9956657c3..1b3da2f34f8d19c8c0df42ceccea045dbea208ac 100644 (file)
@@ -44,4 +44,15 @@ class ApiConfigTest extends TestCase
         $resp->assertJsonCount(2, 'data');
     }
 
+    public function test_requests_per_min_alters_rate_limit()
+    {
+        $resp = $this->actingAsApiEditor()->get($this->endpoint);
+        $resp->assertHeader('x-ratelimit-limit', 180);
+
+        config()->set(['api.requests_per_minute' => 10]);
+
+        $resp = $this->actingAsApiEditor()->get($this->endpoint);
+        $resp->assertHeader('x-ratelimit-limit', 10);
+    }
+
 }
\ No newline at end of file