about summary refs log tree commit diff
path: root/main.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-22 18:08:46 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-22 18:08:46 +0300
commitd64582eee40b9e87fcb64299b88cb58ad8289311 (patch)
tree463c1922f4f56135cb066e552311b437c3fa18aa /main.py
parent1529692aaea6b46ef783ca48e12ace8093d272c2 (diff)
downloadhttpy-d64582eee40b9e87fcb64299b88cb58ad8289311.tar.gz
httpy-d64582eee40b9e87fcb64299b88cb58ad8289311.zip
Update path handling and API part
Diffstat (limited to 'main.py')
-rw-r--r--main.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/main.py b/main.py
index 0844fd7..9ff95e6 100644
--- a/main.py
+++ b/main.py
@@ -42,11 +42,8 @@ PATH_MAP = {
 }
 
 # API
-API_PATH = {
-    "/APIv1/file/generated/1gib",
-    "/APIv1/file/generated/5gib",
-    "/APIv1/file/generated/10gib",
-    "/APIv1/file/generated/20gib",
+API_VERSIONS = {
+    "APIv1"
 }
 
 # internal path map
@@ -212,10 +209,7 @@ class HTTPServer:
             return
 
         # if it's an API request
-        elif request.path in API_PATH:
-            # get API version
-            api_version = request.path.split("/")[1]
-
+        elif (api_version := request.path.split("/")[1]) in API_VERSIONS:
             data = b''
             match api_version:
                 case "APIv1":