From ae3206b9a12568e3187b788b5da90d3acc157b27 Mon Sep 17 00:00:00 2001 From: Kawahara Shotaro <121674121+k-taro56@users.noreply.github.com> Date: Mon, 8 Apr 2024 22:03:44 +0900 Subject: [PATCH] Fix issue with adding random suffix to headers (#3) * Fix issue with adding random suffix to headers * Update dump_headers function signature * Fix issue with dump_headers function --- vercel_storage/blob.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vercel_storage/blob.py b/vercel_storage/blob.py index 59467fa..8400cfc 100644 --- a/vercel_storage/blob.py +++ b/vercel_storage/blob.py @@ -28,7 +28,9 @@ def get_token(options: dict): return _tkn -def dump_headers(options: dict, headers: dict): +def dump_headers(options: Optional[dict], headers: dict): + if options is None: + options = {} if options.get("debug", False): print(tabulate([(k, v) for k, v in headers.items()])) @@ -54,7 +56,7 @@ def put(pathname: str, body: bytes, options: Optional[dict] = None) -> dict: "cacheControlMaxAge", str(DEFAULT_CACHE_AGE) ), } - if "no_suffix" in options: + if options and "no_suffix" in options: headers["x-add-random-suffix"] = "false" dump_headers(options, headers)