Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppeteer_tests: Use POST for flush_caches call.
Tim Abbottf5b7e5d9346e
diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteerindex e8497bc7125..26e874855fd 100755--- a/tools/test-js-with-puppeteer+++ b/tools/test-js-with-puppeteer@@ -90,7 +90,7 @@ def run_tests(files: Iterable[str], external_host: str) -> None:# Resetting test environment.reset_zulip_test_database()# We are calling to /flush_caches to remove all the server-side caches.- response = requests.get("http://zulip.zulipdev.com:9981/flush_caches")+ response = requests.post("http://zulip.zulipdev.com:9981/flush_caches")assert response.status_code == 200if ret != 0:diff --git a/zerver/views/development/cache.py b/zerver/views/development/cache.pyindex 2d9f70932e7..906b8212c46 100644--- a/zerver/views/development/cache.py+++ b/zerver/views/development/cache.py@@ -1,7 +1,9 @@import osfrom django.http import HttpRequest, HttpResponse+from django.views.decorators.csrf import csrf_exempt+from zerver.decorator import require_postfrom zerver.lib.cache import get_cache_backendfrom zerver.lib.response import json_successfrom zerver.models import clear_client_cache, flush_per_request_caches@@ -9,6 +11,8 @@ from zerver.models import clear_client_cache, flush_per_request_cachesZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../")# This is used only by the Puppeteer Tests to clear all the cache after each run.+@csrf_exempt+@require_postdef remove_caches(request: HttpRequest) -> HttpResponse:cache = get_cache_backend(None)cache.clear()