From 7cdcc9099b39f567d40706c75b18bf970989a62b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 4 Jan 2022 14:53:34 +0200 Subject: [PATCH] Escape custom request arguments --- platformio/clients/http.py | 2 +- platformio/clients/registry.py | 4 ++-- platformio/commands/platform.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platformio/clients/http.py b/platformio/clients/http.py index 259d4934..7c20ba50 100644 --- a/platformio/clients/http.py +++ b/platformio/clients/http.py @@ -151,7 +151,7 @@ class HTTPClient(object): def fetch_json_data(self, method, path, **kwargs): if method != "get": cleanup_content_cache("http") - cache_valid = kwargs.pop("cache_valid") if "cache_valid" in kwargs else None + cache_valid = kwargs.pop("x_cache_valid") if "x_cache_valid" in kwargs else None if not cache_valid: return self._parse_json_response(self.send_request(method, path, **kwargs)) cache_key = ContentCache.key_from_args( diff --git a/platformio/clients/registry.py b/platformio/clients/registry.py index f344d1d1..aba734ff 100644 --- a/platformio/clients/registry.py +++ b/platformio/clients/registry.py @@ -135,7 +135,7 @@ class RegistryClient(HTTPClient): "get", "/v3/search", params=params, - cache_valid="1h", + x_cache_valid="1h", x_with_authorization=self.allowed_private_packages(), ) @@ -147,7 +147,7 @@ class RegistryClient(HTTPClient): type=type_, owner=owner.lower(), name=name.lower() ), params=dict(version=version) if version else None, - cache_valid="1h", + x_cache_valid="1h", x_with_authorization=self.allowed_private_packages(), ) except HTTPClientError as e: diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 84945e39..287f5760 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -61,7 +61,7 @@ def platform_frameworks(query, json_output): regclient = PlatformPackageManager().get_registry_client_instance() frameworks = [] for framework in regclient.fetch_json_data( - "get", "/v2/frameworks", cache_valid="1d" + "get", "/v2/frameworks", x_cache_valid="1d" ): if query == "all": query = "" @@ -354,7 +354,7 @@ def _print_platforms(platforms): def _get_registry_platforms(): regclient = PlatformPackageManager().get_registry_client_instance() - return regclient.fetch_json_data("get", "/v2/platforms", cache_valid="1d") + return regclient.fetch_json_data("get", "/v2/platforms", x_cache_valid="1d") def _get_platform_data(*args, **kwargs):