Browse Source

Merge 1cd674a183 into 7b2631a88d

pull/9499/merge
Alexander Gherm 3 days ago
committed by GitHub
parent
commit
c879ce0e50
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      fastapi/applications.py

4
fastapi/applications.py

@ -285,6 +285,7 @@ class FastAPI(Starlette):
"""
),
] = None,
openapi_response_class: Type[JSONResponse] = JSONResponse,
servers: Annotated[
Optional[List[Dict[str, Union[str, Any]]]],
Doc(
@ -830,6 +831,7 @@ class FastAPI(Starlette):
self.license_info = license_info
self.openapi_url = openapi_url
self.openapi_tags = openapi_tags
self.openapi_response_class = openapi_response_class
self.root_path_in_servers = root_path_in_servers
self.docs_url = docs_url
self.redoc_url = redoc_url
@ -1006,7 +1008,7 @@ class FastAPI(Starlette):
if root_path and self.root_path_in_servers:
self.servers.insert(0, {"url": root_path})
server_urls.add(root_path)
return JSONResponse(self.openapi())
return self.openapi_response_class(self.openapi())
self.add_route(self.openapi_url, openapi, include_in_schema=False)
if self.openapi_url and self.docs_url:

Loading…
Cancel
Save