Handle empty requests for ping, add a bit of styling
This commit is contained in:
parent
b520913c47
commit
3cb29002df
@ -15,6 +15,8 @@ def handle(req):
|
|||||||
"author": "bat",
|
"author": "bat",
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
if not req:
|
||||||
|
return "Foo", 200, {"Content-Type": "text/plain"}
|
||||||
try:
|
try:
|
||||||
args = loads(req)
|
args = loads(req)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -25,7 +27,7 @@ def handle(req):
|
|||||||
c.image.save(byte_arr, format="JPEG")
|
c.image.save(byte_arr, format="JPEG")
|
||||||
|
|
||||||
return (
|
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,
|
200,
|
||||||
{"Content-Type": "text/html"},
|
{"Content-Type": "text/html"},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user