]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Show nicer warning when `ujson` isn't installed (#728)
authorJake Howard <RealOrangeOne@users.noreply.github.com>
Fri, 22 Nov 2019 11:22:15 +0000 (11:22 +0000)
committerTom Christie <tom@tomchristie.com>
Fri, 22 Nov 2019 11:22:15 +0000 (11:22 +0000)
starlette/responses.py

index 7d5afbae6d383439ee818bd1218fa35c994e813e..e843a1e4044167e607a50340f58bf93f7e0eb25e 100644 (file)
@@ -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")