[responses] cast set to list.
This commit is contained in:
parent
d21ee175e9
commit
a5300962ad
|
@ -58,14 +58,19 @@ class ORJSONResponse(JSONResponse):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_cast(x):
|
def default_cast(x):
|
||||||
types = {
|
str_types = {
|
||||||
decimal.Decimal
|
decimal.Decimal
|
||||||
}
|
}
|
||||||
|
list_types = {
|
||||||
|
type(set)
|
||||||
|
}
|
||||||
|
|
||||||
if type(x) not in types:
|
if type(x) in str_types:
|
||||||
raise TypeError('Type is not handled in ORJSONResponse')
|
|
||||||
|
|
||||||
return str(x)
|
return str(x)
|
||||||
|
if type(x) in list_types:
|
||||||
|
return list(x)
|
||||||
|
|
||||||
|
raise TypeError(f'Type {type(x)} is not handled in ORJSONResponse')
|
||||||
|
|
||||||
|
|
||||||
class HJSONResponse(ORJSONResponse):
|
class HJSONResponse(ORJSONResponse):
|
||||||
|
|
Loading…
Reference in New Issue