Handle empty requests for ping, add a bit of styling

This commit is contained in:
Roberto Alsina 2023-05-16 14:01:04 -03:00
parent b520913c47
commit 3cb29002df

View File

@ -15,6 +15,8 @@ def handle(req):
"author": "bat",
}
"""
if not req:
return "Foo", 200, {"Content-Type": "text/plain"}
try:
args = loads(req)
except Exception:
@ -25,7 +27,7 @@ def handle(req):
c.image.save(byte_arr, format="JPEG")
return (
f'<img src="data:image/jpeg;base64, {base64.b64encode(byte_arr.getvalue()).decode("utf-8")}">',
f'<img src="data:image/jpeg;base64, {base64.b64encode(byte_arr.getvalue()).decode("utf-8")}" style="width: 100%; border: solid 1px #aaa;">',
200,
{"Content-Type": "text/html"},
)