Remove redundant body encoding in _send_response()

Commit 538781b · patx · 2025-02-10T21:49:09-05:00

Changeset
538781bc6fc9f2a72d6798bac02d38478dd09508
Parents
4bd451081b77a6c763fdd8eb5731c2ede98e8567

View source at this commit

Comments

No comments yet.

Log in to comment

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",