diff --git a/fastapi/responses.py b/fastapi/responses.py index 65d0ba394..c915cc7cb 100644 --- a/fastapi/responses.py +++ b/fastapi/responses.py @@ -66,6 +66,6 @@ class BSONResponse(Response): media_type = "application/bson" - def render(self, content: Any) -> bytes: + def render(self, content: Any) -> Any: assert bson is not None, "bson must be installed to use BSONResponse" return bson.dumps(content) diff --git a/pyproject.toml b/pyproject.toml index 1c540e2f6..658a62dba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,8 @@ all = [ "ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0", # For ORJSONResponse "orjson >=3.2.1", + # For BSONResponse + "bson >=0.5.10", # To validate email fields "email-validator >=2.0.0", # Uvicorn with uvloop