Skip to content

Commit

Permalink
Relative url param.
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Gwiazda committed Aug 24, 2020
1 parent 4697941 commit 0ebdc86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aiohttp_apispec/aiohttp_apispec.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ async def doc_routes(app_):
async def swagger_handler(request):
return web.json_response(request.app["swagger_dict"])

app.router.add_route("GET", self.url, swagger_handler, name=NAME_SWAGGER_SPEC)
route_url = self.url
if not self.url.startswith("/"):
route_url = "/{}".format(route_url)
app.router.add_route("GET", route_url, swagger_handler, name=NAME_SWAGGER_SPEC)

if self.swagger_path is not None:
self._add_swagger_web_page(app, self.static_path, self.swagger_path)
Expand Down

0 comments on commit 0ebdc86

Please sign in to comment.