mirror of https://github.com/encode/starlette.git
Show nicer warning when `ujson` isn't installed (#728)
This commit is contained in:
parent
4152533ce4
commit
338d5ab0ae
|
@ -156,6 +156,7 @@ class UJSONResponse(JSONResponse):
|
|||
media_type = "application/json"
|
||||
|
||||
def render(self, content: typing.Any) -> bytes:
|
||||
assert ujson is not None, "ujson must be installed to use UJSONResponse"
|
||||
return ujson.dumps(content, ensure_ascii=False).encode("utf-8")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue