about summary refs log tree commit diff
path: root/main.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-22 04:52:07 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-22 04:52:07 +0300
commit45680d00a4a8ed288d2a78baddb5e7c7e2e95cef (patch)
treee77424b1fe01bc935c993e357593946b9bd4216b /main.py
parent9a539001f3f1e77a6ea8332f659695d7ddcedb2f (diff)
downloadhttpy-45680d00a4a8ed288d2a78baddb5e7c7e2e95cef.tar.gz
httpy-45680d00a4a8ed288d2a78baddb5e7c7e2e95cef.zip
API seems to work
Diffstat (limited to 'main.py')
-rw-r--r--main.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.py b/main.py
index dc80db6..0844fd7 100644
--- a/main.py
+++ b/main.py
@@ -216,6 +216,7 @@ class HTTPServer:
             # get API version
             api_version = request.path.split("/")[1]
 
+            data = b''
             match api_version:
                 case "APIv1":
                     status, data = await APIv1.respond(client, request)
@@ -225,6 +226,10 @@ class HTTPServer:
             # if status is not 200 -> send bad response
             if status != 200:
                 await HTTPServer._bad_response(client, status)
+                return
+
+            # send data if no error
+            await HTTPServer._send(client, status, data)
 
             # return after answer
             return