From ccc94554085e0af0bd66027dddc3b38ee5075ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:06:30 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/requests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LunaTranslator/LunaTranslator/requests.py b/LunaTranslator/LunaTranslator/requests.py index 4ba1b2d8..9acae904 100644 --- a/LunaTranslator/LunaTranslator/requests.py +++ b/LunaTranslator/LunaTranslator/requests.py @@ -185,7 +185,9 @@ class Requester_common: dataptr = (dataptr).encode("utf8") datalen = len(dataptr) # print('dataptr',dataptr) - if "Content-Type" not in headers: + if isinstance(data, (str, bytes)): + pass + elif "Content-Type" not in headers: headers["Content-Type"] = "application/x-www-form-urlencoded" elif js: dataptr = json.dumps(js).encode("utf8")