Skip to content

Commit cabbd7f

Browse files
committed
Added StreamingResponse casting
1 parent 68bd400 commit cabbd7f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

debug_toolbar/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def dispatch(
7171
return await call_next(request)
7272

7373
toolbar = DebugToolbar(request, call_next, self.settings)
74-
response = await toolbar.process_request(request)
74+
response = t.cast(StreamingResponse, await toolbar.process_request(request))
7575
content_type = response.headers.get("Content-Type", "")
7676
is_html = content_type.startswith("text/html")
7777

@@ -87,7 +87,7 @@ async def dispatch(
8787
if is_html:
8888
body = b""
8989

90-
async for chunk in response.body_iterator: # type: ignore[attr-defined]
90+
async for chunk in response.body_iterator:
9191
if not isinstance(chunk, bytes):
9292
chunk = chunk.encode(response.charset)
9393
body += chunk
@@ -104,7 +104,7 @@ async def dispatch(
104104
async def stream() -> t.AsyncGenerator[bytes, None]:
105105
yield body
106106

107-
response.body_iterator = stream() # type: ignore[attr-defined]
107+
response.body_iterator = stream()
108108
else:
109109
data = parse.quote(json.dumps(toolbar.refresh()))
110110
response.set_cookie(key="dtRefresh", value=data)

0 commit comments

Comments
 (0)