MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / do_GET

Method do_GET

tests/loadtest/tools/dashboard.py:27–53  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25 server_version = "LedgerForgeBenchmarkDashboard/1.0"
26
27 def do_GET(self) -> None: # noqa: N802
28 parsed = urlparse(self.path)
29 path = parsed.path
30
31 if path in {"/", ""}:
32 self.redirect("/dashboard/")
33 return
34 if path == "/api/runs":
35 self.send_json({"runs": discover_runs(scan_root)})
36 return
37 if path.startswith("/api/runs/"):
38 run_id = unquote(path.removeprefix("/api/runs/"))
39 self.handle_run(run_id)
40 return
41 if path == "/dashboard" or path == "/dashboard/":
42 self.serve_file(DASHBOARD_DIR / "index.html")
43 return
44 if path.startswith("/dashboard/"):
45 relative = Path(path.removeprefix("/dashboard/"))
46 target = (DASHBOARD_DIR / relative).resolve()
47 if DASHBOARD_DIR not in target.parents and target != DASHBOARD_DIR:
48 self.send_error(HTTPStatus.NOT_FOUND, "Not found")
49 return
50 self.serve_file(target)
51 return
52
53 self.send_error(HTTPStatus.NOT_FOUND, "Not found")
54
55 def log_message(self, format: str, *args) -> None: # noqa: A003
56 return

Callers

nothing calls this directly

Calls 5

redirectMethod · 0.95
send_jsonMethod · 0.95
handle_runMethod · 0.95
serve_fileMethod · 0.95
discover_runsFunction · 0.90

Tested by

no test coverage detected