MCPcopy Index your code
hub / github.com/anomalyco/opencode / redactEvent

Function redactEvent

packages/http-recorder/src/socket.ts:42–49  ·  view source on GitHub ↗
(event: WebSocketEvent, redactor: Redactor)

Source from the content-addressed store, hash-verified

40 event.kind === "text" ? event.body : new Uint8Array(Buffer.from(event.body, "base64"))
41
42const redactEvent = (event: WebSocketEvent, redactor: Redactor): WebSocketEvent => {
43 if (event.kind === "binary") return event
44 const body =
45 event.direction === "client"
46 ? redactor.request({ method: "WEBSOCKET", url: "", headers: {}, body: event.body }).body
47 : redactor.response({ status: 101, headers: {}, body: event.body }).body
48 return { ...event, body }
49}
50
51const comparable = (event: WebSocketEvent, asJson: boolean) => {
52 if (!asJson || event.kind === "binary") return JSON.stringify(canonicalizeJson(event))

Callers 2

makeRecordingSocketFunction · 0.70
makeReplaySocketFunction · 0.70

Calls 2

requestMethod · 0.45
responseMethod · 0.45

Tested by

no test coverage detected