(event: WebSocketEvent, redactor: Redactor)
| 40 | event.kind === "text" ? event.body : new Uint8Array(Buffer.from(event.body, "base64")) |
| 41 | |
| 42 | const 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 | |
| 51 | const comparable = (event: WebSocketEvent, asJson: boolean) => { |
| 52 | if (!asJson || event.kind === "binary") return JSON.stringify(canonicalizeJson(event)) |
no test coverage detected