refactor: centralize ndjson streaming transport

This commit is contained in:
leefer
2026-08-02 01:53:47 +08:00
parent e8ba63e087
commit 8d43f4c372
10 changed files with 159 additions and 46 deletions
-10
View File
@@ -1020,16 +1020,6 @@ class RequestHandler(
return
self.send_json({"error": "Not found"}, HTTPStatus.NOT_FOUND)
def _write_stream_event(self, payload: dict[str, Any]) -> None:
self.wfile.write(
(json.dumps(payload, ensure_ascii=False, separators=(",", ":")) + "\n").encode("utf-8")
)
self.wfile.flush()
def save_reason(self) -> None:
try:
body = self.read_json_body()