mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
refactoring
This commit is contained in:
parent
5b11b6bc55
commit
3e402f4d7b
@ -129,7 +129,7 @@ class MsdApi:
|
||||
|
||||
get_logger(0).info("Downloading image %r as %r to MSD ...", url, name)
|
||||
async with self.__msd.write_image(name, size) as chunk_size:
|
||||
response = await start_streaming(request)
|
||||
response = await start_streaming(request, "application/x-ndjson")
|
||||
await stream_write_info()
|
||||
last_report_ts = 0
|
||||
async for chunk in remote.content.iter_chunked(chunk_size):
|
||||
|
||||
@ -187,7 +187,7 @@ def make_json_exception(err: Exception, status: Optional[int]=None) -> Response:
|
||||
}, status=status)
|
||||
|
||||
|
||||
async def start_streaming(request: Request, content_type: str="application/x-ndjson") -> StreamResponse:
|
||||
async def start_streaming(request: Request, content_type: str) -> StreamResponse:
|
||||
response = StreamResponse(status=200, reason="OK", headers={"Content-Type": content_type})
|
||||
await response.prepare(request)
|
||||
return response
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user