Avoid AttributeError when key or value are already decoded

pull/174/head
Sarah 1 year ago committed by GitHub
parent d9abbb5a8d
commit 70d807b164
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -262,7 +262,11 @@ def main(override_args: Optional[Sequence[str]] = 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