Changing the default response class of FastAPI
09-09-2022
class ORJSONResponse(JSONResponse):
media_type = "application/json"
def render(self, content: typing.Any) -> bytes:
return orjson.dumps(content)
app = FastAPI(default_response_class=ORJSONResponse)