Avoid AttributeError when key or value are already decoded (#174)

master
Sarah 5 days ago committed by GitHub
parent b2dafc87e7
commit 72638cd34c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -264,7 +264,11 @@ def main(override_args: Sequence[str] | None = None):
did_find_anything = False
for key, value in body_val_bytes.items():
did_find_anything = True
body_val[key.decode("utf-8")] = value.decode("utf-8")
if type(key) != str:
key = key.decode("utf-8")
if type(value) != str:
value = value.decode("utf-8")
body_val[key] = value
if did_find_anything:
content_type = "application/x-www-form-urlencoded"
else:

Loading…
Cancel
Save