Browse Source

🔨 tweaked encoder primative key skip to disallow subclasses

pull/13982/head
Ben Brady 4 weeks ago
parent
commit
c5454038d5
  1. 4
      fastapi/encoders.py

4
fastapi/encoders.py

@ -375,7 +375,9 @@ def encode_dict(
if key not in allowed_keys:
continue
if isinstance(key, primitive_types):
# use type() in, instead of isinstance
# we don't want to allow subclasses, they should be encoded still
if type(key) in primitive_types:
encoded_key = key
else:
encoded_key = encode_value(

Loading…
Cancel
Save