[FIX] sometimes responses dont contain a _path reference
This commit is contained in:
parent
ddd7f77551
commit
3dd5357f24
1 changed files with 2 additions and 2 deletions
|
|
@ -262,8 +262,8 @@ class HttpAPI:
|
|||
|
||||
response: Response = await handler(request)
|
||||
|
||||
contentType: str | None = response.headers.get("content-type", None)
|
||||
if contentType and contentType.startswith("text/html"):
|
||||
contentType: str = response.headers.get("content-type", "")
|
||||
if contentType.startswith("text/html") and getattr(response, "_path", None):
|
||||
rewrite_path: str = base_path.rstrip("/")
|
||||
async with await anyio.open_file(response._path, "rb") as f:
|
||||
content = await f.read()
|
||||
|
|
|
|||
Loading…
Reference in a new issue