MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / encodeResponse

Function encodeResponse

crates/opencode-plugin/host/plugin-host.ts:78–82  ·  view source on GitHub ↗
(response: JsonRpcResponse)

Source from the content-addressed store, hash-verified

76const decoder = new TextDecoder();
77
78function encodeResponse(response: JsonRpcResponse): Uint8Array {
79 const body = JSON.stringify(response);
80 const header = `Content-Length: ${Buffer.byteLength(body)}\r\n\r\n`;
81 return encoder.encode(header + body);
82}
83
84/**
85 * Read exactly `n` bytes from stdin.

Callers 1

sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected