Skip to content

Commit 946030a

Browse files
committed
Fix formatting of base routes
1 parent 10ef502 commit 946030a

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

integration_tests/base_routes.py

+22-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@
77
websocket = WS(app, "/web_socket")
88
i = -1
99

10+
1011
@websocket.on("message")
1112
async def connect():
1213
global i
13-
i+=1
14-
if i==0:
14+
i += 1
15+
if i == 0:
1516
return "Whaaat??"
16-
elif i==1:
17+
elif i == 1:
1718
return "Whooo??"
18-
elif i==2:
19+
elif i == 2:
1920
i = -1
2021
return "*chika* *chika* Slim Shady."
2122

23+
2224
@websocket.on("close")
2325
def close():
2426
return "GoodBye world, from ws"
2527

28+
2629
@websocket.on("connect")
2730
def message():
2831
return "Hello world, from ws"
@@ -47,10 +50,12 @@ async def test(request):
4750

4851
return static_file(html_file)
4952

53+
5054
@app.get("/jsonify")
5155
async def json_get():
5256
return jsonify({"hello": "world"})
5357

58+
5459
@app.get("/query")
5560
async def query_get(request):
5661
query_data = request["queries"]
@@ -62,18 +67,22 @@ async def json(request):
6267
print(request["params"]["id"])
6368
return jsonify({"hello": "world"})
6469

70+
6571
@app.post("/post")
6672
async def post():
6773
return "POST Request"
6874

75+
6976
@app.post("/post_with_body")
7077
async def postreq_with_body(request):
7178
return bytearray(request["body"]).decode("utf-8")
7279

80+
7381
@app.put("/put")
7482
async def put(request):
7583
return "PUT Request"
7684

85+
7786
@app.put("/put_with_body")
7887
async def putreq_with_body(request):
7988
print(request)
@@ -84,6 +93,7 @@ async def putreq_with_body(request):
8493
async def delete():
8594
return "DELETE Request"
8695

96+
8797
@app.delete("/delete_with_body")
8898
async def deletereq_with_body(request):
8999
return bytearray(request["body"]).decode("utf-8")
@@ -93,6 +103,7 @@ async def deletereq_with_body(request):
93103
async def patch():
94104
return "PATCH Request"
95105

106+
96107
@app.patch("/patch_with_body")
97108
async def patchreq_with_body(request):
98109
return bytearray(request["body"]).decode("utf-8")
@@ -107,6 +118,7 @@ async def sleeper():
107118
@app.get("/blocker")
108119
def blocker():
109120
import time
121+
110122
time.sleep(10)
111123
return "blocker function"
112124

@@ -121,10 +133,14 @@ def shutdown_handler():
121133

122134

123135
if __name__ == "__main__":
124-
ROBYN_URL = os.getenv("ROBYN_URL", '0.0.0.0')
136+
ROBYN_URL = os.getenv("ROBYN_URL", "0.0.0.0")
125137
app.add_header("server", "robyn")
126138
current_file_path = pathlib.Path(__file__).parent.resolve()
127139
os.path.join(current_file_path, "build")
128-
app.add_directory(route="/test_dir",directory_path=os.path.join(current_file_path, "build/"), index_file="index.html")
140+
app.add_directory(
141+
route="/test_dir",
142+
directory_path=os.path.join(current_file_path, "build/"),
143+
index_file="index.html",
144+
)
129145
app.startup_handler(startup_handler)
130146
app.start(port=5000, url=ROBYN_URL)

0 commit comments

Comments
 (0)