patx/micropie
Remove redundant body encoding in _send_response()
Commit 538781b · patx · 2025-02-10T21:49:09-05:00
Comments
No comments yet.
Diff
diff --git a/MicroPie.py b/MicroPie.py
index 1db0b0a..ef869bd 100644
--- a/MicroPie.py
+++ b/MicroPie.py
@@ -413,7 +413,7 @@ class App:
response_body = body
else:
response_body = str(body).encode("utf-8")
- response_body = body.encode("utf-8") if isinstance(body, str) else body
+
await send({
"type": "http.response.body",
"body": response_body,
diff --git a/setup.py b/setup.py
index ae3adfe..e7abb43 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ MicroPie is Fun
class MyApp(App):
- def index(self):
+ async def index(self):
return 'Hello world!'
app = MyApp() # Run with `uvicorn app:app`
@@ -25,7 +25,7 @@ Links
from distutils.core import setup
setup(name="MicroPie",
- version="0.9.6",
+ version="0.9.7",
description="A ultra micro web framework w/ Jinja2.",
long_description=__doc__,
author="Harrison Erd",