Skip to content

Commit 7b19681

Browse files
authored
return 404 on missing value in KV example (#22)
* return 404 on missing value in KV example Signed-off-by: Joel Dice <[email protected]> * remove .spin directory and add to .gitignore Signed-off-by: Joel Dice <[email protected]> --------- Signed-off-by: Joel Dice <[email protected]>
1 parent fbe3c6d commit 7b19681

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/Cargo.lock
33
__pycache__
44
*.wasm
5+
.spin
-12 KB
Binary file not shown.

examples/KV/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ def handle_request(request):
99
match request.method:
1010
case "GET":
1111
value = store.get(request.uri)
12-
return Response(200, [("content-type", "text/plain")], value)
12+
if value:
13+
status = 200
14+
else:
15+
status = 404
16+
return Response(status, [("content-type", "text/plain")], value)
1317
case "POST":
1418
store.set(request.uri, request.body)
1519
return Response(200, [("content-type", "text/plain")])

0 commit comments

Comments
 (0)