mirror of https://github.com/tiangolo/fastapi.git
Merge abadf94506 into 272204c0c7
This commit is contained in:
commit
88cf28467e
|
|
@ -1,3 +1,4 @@
|
||||||
|
import html as html_escape
|
||||||
import json
|
import json
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
|
|
@ -121,7 +122,7 @@ def get_swagger_ui_html(
|
||||||
<head>
|
<head>
|
||||||
<link type="text/css" rel="stylesheet" href="{swagger_css_url}">
|
<link type="text/css" rel="stylesheet" href="{swagger_css_url}">
|
||||||
<link rel="shortcut icon" href="{swagger_favicon_url}">
|
<link rel="shortcut icon" href="{swagger_favicon_url}">
|
||||||
<title>{title}</title>
|
<title>{html_escape.escape(title)}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="swagger-ui">
|
<div id="swagger-ui">
|
||||||
|
|
@ -130,7 +131,7 @@ def get_swagger_ui_html(
|
||||||
<!-- `SwaggerUIBundle` is now available on the page -->
|
<!-- `SwaggerUIBundle` is now available on the page -->
|
||||||
<script>
|
<script>
|
||||||
const ui = SwaggerUIBundle({{
|
const ui = SwaggerUIBundle({{
|
||||||
url: '{openapi_url}',
|
url: '{html_escape.escape(openapi_url)}',
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for key, value in current_swagger_ui_parameters.items():
|
for key, value in current_swagger_ui_parameters.items():
|
||||||
|
|
@ -221,7 +222,7 @@ def get_redoc_html(
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{title}</title>
|
<title>{html_escape.escape(title)}</title>
|
||||||
<!-- needed for adaptive design -->
|
<!-- needed for adaptive design -->
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
@ -246,7 +247,7 @@ def get_redoc_html(
|
||||||
<noscript>
|
<noscript>
|
||||||
ReDoc requires Javascript to function. Please enable it to browse the documentation.
|
ReDoc requires Javascript to function. Please enable it to browse the documentation.
|
||||||
</noscript>
|
</noscript>
|
||||||
<redoc spec-url="{openapi_url}"></redoc>
|
<redoc spec-url="{html_escape.escape(openapi_url)}"></redoc>
|
||||||
<script src="{redoc_js_url}"> </script>
|
<script src="{redoc_js_url}"> </script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue