ai-station/.venv/lib/python3.12/site-packages/mcp/server/auth/json_response.py

11 lines
377 B
Python
Raw Permalink Normal View History

2025-12-25 14:54:33 +00:00
from typing import Any
from starlette.responses import JSONResponse
class PydanticJSONResponse(JSONResponse):
# use pydantic json serialization instead of the stock `json.dumps`,
# so that we can handle serializing pydantic models like AnyHttpUrl
def render(self, content: Any) -> bytes:
return content.model_dump_json(exclude_none=True).encode("utf-8")