Skip to content

Commit f2d4250

Browse files
committed
Added URL type
1 parent a40de15 commit f2d4250

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

debug_toolbar/panels/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import typing as t
22

33
from fastapi import Request, Response
4+
from starlette.datastructures import URL
45
from starlette.middleware.base import RequestResponseEndpoint
56

67
from debug_toolbar.types import ServerTiming, Stats
@@ -66,11 +67,11 @@ def content(self) -> str:
6667
def render(self, **context: t.Any) -> str:
6768
return self.toolbar.render(self.template, **context)
6869

69-
def url_for(self, name: str, **path_params: t.Any) -> str:
70+
def url_for(self, name: str, **path_params: t.Any) -> URL:
7071
return self.toolbar.request.url_for(name, **path_params)
7172

7273
@property
73-
def scripts(self) -> t.List[str]:
74+
def scripts(self) -> t.List[URL]:
7475
return []
7576

7677
async def process_request(self, request: Request) -> Response:

debug_toolbar/panels/timer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from time import perf_counter
33

44
from fastapi import Request, Response
5+
from starlette.datastructures import URL
56

67
from debug_toolbar.panels import Panel
78
from debug_toolbar.types import ServerTiming, Stats
@@ -45,7 +46,7 @@ def content(self) -> str:
4546
return self.render(rows=rows)
4647

4748
@property
48-
def scripts(self) -> t.List[str]:
49+
def scripts(self) -> t.List[URL]:
4950
scripts = super().scripts
5051
scripts.append(self.url_for("debug_toolbar.static", path="js/timer.js"))
5152
return scripts

debug_toolbar/panels/versions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import typing as t
22

33
from fastapi import Request, Response, __version__
4+
from starlette.datastructures import URL
45

56
from debug_toolbar.panels import Panel
67
from debug_toolbar.types import Stats
@@ -15,7 +16,7 @@ def nav_subtitle(self) -> str:
1516
return f"FastAPI {__version__}"
1617

1718
@property
18-
def scripts(self) -> t.List[str]:
19+
def scripts(self) -> t.List[URL]:
1920
scripts = super().scripts
2021
scripts.append(self.url_for("debug_toolbar.static", path="js/versions.js"))
2122
return scripts

0 commit comments

Comments
 (0)