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:
|
else:
|
||||||
proxymodelog.info(f"HTTP Proxy Request to EcoVacs (body=false) (host:{request.host}) - {ecorequest}")
|
proxymodelog.info(f"HTTP Proxy Request to EcoVacs (body=false) (host:{request.host}) - {ecorequest}")
|
||||||
async with session.request(request.method, ecorequest) as resp:
|
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()
|
ecoresp = await resp.text()
|
||||||
proxymodelog.info(f"HTTP Proxy Response from EcoVacs (URL: {ecorequest}) - (Status: {resp.status}) - {ecoresp}")
|
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":
|
if resp.content_type == "application/json":
|
||||||
ecoresp = json.loads(ecoresp)
|
ecoresp = json.loads(ecoresp)
|
||||||
return web.json_response(ecoresp)
|
return web.json_response(ecoresp)
|
||||||
|
elif resp.content_type == "application/octet-stream":
|
||||||
|
return web.Response(body=ecoresp)
|
||||||
else:
|
else:
|
||||||
return web.Response(text=ecoresp)
|
return web.Response(text=ecoresp)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue