MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / _encode_message

Function _encode_message

benches/memory_usage.py:102–106  ·  view source on GitHub ↗

Encode a JSON-RPC message with Content-Length header.

(obj: dict[str, Any])

Source from the content-addressed store, hash-verified

100
101
102def _encode_message(obj: dict[str, Any]) -> bytes:
103 """Encode a JSON-RPC message with Content-Length header."""
104 body = json.dumps(obj).encode("utf-8")
105 header = f"Content-Length: {len(body)}\r\n\r\n".encode("ascii")
106 return header + body
107
108
109def _read_headers(stream) -> dict[str, str]:

Callers 1

_send_rawMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected