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

Method send_json

tests/loadtest/tools/dashboard.py:65–82  ·  view source on GitHub ↗
(self, payload: object)

Source from the content-addressed store, hash-verified

63 self.send_error(HTTPStatus.NOT_FOUND, "Run not found")
64
65 def send_json(self, payload: object) -> None:
66 body = json.dumps(payload).encode("utf-8")
67 etag = payload_etag(payload)
68 if self.headers.get("If-None-Match") == etag:
69 self.send_response(HTTPStatus.NOT_MODIFIED)
70 self.send_header("ETag", etag)
71 self.end_headers()
72 return
73 self.send_response(HTTPStatus.OK)
74 self.send_header("Content-Type", "application/json; charset=utf-8")
75 self.send_header("Content-Length", str(len(body)))
76 self.send_header("Cache-Control", "no-store")
77 self.send_header("ETag", etag)
78 self.end_headers()
79 try:
80 self.wfile.write(body)
81 except (BrokenPipeError, ConnectionResetError):
82 return
83
84 def serve_file(self, path: Path) -> None:
85 if not path.exists() or not path.is_file():

Callers 2

do_GETMethod · 0.95
handle_runMethod · 0.95

Calls 1

payload_etagFunction · 0.90

Tested by

no test coverage detected