Spaces:
Runtime error
Runtime error
Commit ·
1b42251
1
Parent(s): 68d613d
worker: add HEAD support for health/sftp-test
Browse files
worker.py
CHANGED
|
@@ -20,6 +20,25 @@ if not API_BASE or not WORKER_TOKEN:
|
|
| 20 |
|
| 21 |
|
| 22 |
class Handler(BaseHTTPRequestHandler):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def do_GET(self):
|
| 24 |
path = self.path.split('?', 1)[0]
|
| 25 |
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
class Handler(BaseHTTPRequestHandler):
|
| 23 |
+
|
| 24 |
+
def do_HEAD(self):
|
| 25 |
+
path = self.path.split("?", 1)[0]
|
| 26 |
+
|
| 27 |
+
if path in ("/", "/health"):
|
| 28 |
+
self.send_response(200)
|
| 29 |
+
self.end_headers()
|
| 30 |
+
return
|
| 31 |
+
|
| 32 |
+
if path == "/sftp-test":
|
| 33 |
+
# no body on HEAD
|
| 34 |
+
self.send_response(200)
|
| 35 |
+
self.end_headers()
|
| 36 |
+
return
|
| 37 |
+
|
| 38 |
+
# if you have /api/pdf routes in worker, add them here too
|
| 39 |
+
self.send_response(404)
|
| 40 |
+
self.end_headers()
|
| 41 |
+
|
| 42 |
def do_GET(self):
|
| 43 |
path = self.path.split('?', 1)[0]
|
| 44 |
|