handle images and bytes
handle images and bytes
This commit is contained in:
parent
346895eff3
commit
f97c07ac7b
1 changed files with 6 additions and 1 deletions
|
|
@ -137,6 +137,9 @@ class ConfServer:
|
|||
else:
|
||||
proxymodelog.info(f"HTTP Proxy Request to EcoVacs (body=false) (host:{request.host}) - {ecorequest}")
|
||||
async with session.request(request.method, ecorequest) as resp:
|
||||
if resp.content_type == "application/octet-stream":
|
||||
ecoresp = await resp.read()
|
||||
else:
|
||||
ecoresp = await resp.text()
|
||||
proxymodelog.info(f"HTTP Proxy Response from EcoVacs (URL: {ecorequest}) - (Status: {resp.status}) - {ecoresp}")
|
||||
|
||||
|
|
@ -144,6 +147,8 @@ class ConfServer:
|
|||
if resp.content_type == "application/json":
|
||||
ecoresp = json.loads(ecoresp)
|
||||
return web.json_response(ecoresp)
|
||||
elif resp.content_type == "application/octet-stream":
|
||||
return web.Response(body=ecoresp)
|
||||
else:
|
||||
return web.Response(text=ecoresp)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue