Browse Source

feat: add bson serializing in FastAPI, upd: pyproject.toml add dependency

pull/13760/head
WrldEngine 1 month ago
parent
commit
b22ef059e6
  1. 2
      fastapi/responses.py
  2. 2
      pyproject.toml

2
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)

2
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

Loading…
Cancel
Save