From f0e128c5a267a829b4334118c0dafb4287caafb9 Mon Sep 17 00:00:00 2001 From: zhangfuqiang01 Date: Thu, 17 Oct 2024 02:16:27 -0700 Subject: [PATCH] Fix issue #6557: Treat empty lists as empty strings in URL parameters --- src/requests/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/requests/models.py b/src/requests/models.py index 8f56ca7d23..e2712f6369 100644 --- a/src/requests/models.py +++ b/src/requests/models.py @@ -114,6 +114,8 @@ def _encode_params(data): if isinstance(data, (str, bytes)): return data + elif isinstance(data, list) and not data: + return '' elif hasattr(data, "read"): return data elif hasattr(data, "__iter__"):