Fix /docs/ redirects
This commit is contained in:
parent
55c4acad8f
commit
c04e3c5666
|
@ -523,7 +523,9 @@ class KoboldAPISpec(APISpec):
|
|||
self._prefixes = prefixes if prefixes is not None else [""]
|
||||
super().__init__(*args, title=title, openapi_version=openapi_version, plugins=plugins, servers=[{"url": self._prefixes[0]}], **kwargs)
|
||||
for prefix in self._prefixes:
|
||||
app.route(prefix, endpoint="~KoboldAPISpec~" + prefix, strict_slashes=False)(app.route(prefix + "/docs", endpoint="~KoboldAPISpec~" + prefix + "/docs")(lambda: redirect(prefix + "/docs/")))
|
||||
app.route(prefix, endpoint="~KoboldAPISpec~" + prefix)(lambda: redirect(request.path + "/docs/"))
|
||||
app.route(prefix + "/", endpoint="~KoboldAPISpec~" + prefix + "/")(lambda: redirect("docs/"))
|
||||
app.route(prefix + "/docs", endpoint="~KoboldAPISpec~" + prefix + "/docs")(lambda: redirect("docs/"))
|
||||
app.route(prefix + "/docs/", endpoint="~KoboldAPISpec~" + prefix + "/docs/")(lambda: render_template("swagger-ui.html", url=self._prefixes[0] + "/openapi.json"))
|
||||
app.route(prefix + "/openapi.json", endpoint="~KoboldAPISpec~" + prefix + "/openapi.json")(lambda: jsonify(self.to_dict()))
|
||||
|
||||
|
|
Loading…
Reference in New Issue