diff --git a/starlette/responses.py b/starlette/responses.py index 7d5afbae..e843a1e4 100644 --- a/starlette/responses.py +++ b/starlette/responses.py @@ -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")