MCPcopy Create free account
hub / github.com/anomalyco/opencode / safeText

Function safeText

packages/http-recorder/src/matching.ts:39–45  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

37 canonicalSnapshot(incoming) === canonicalSnapshot(recorded)
38
39export const safeText = (value: unknown) => {
40 if (value === undefined) return "undefined"
41 if (secretFindings(value).length > 0) return JSON.stringify(REDACTED)
42 const text = JSON.stringify(value)
43 if (!text) return typeof value
44 return text.length > 300 ? `${text.slice(0, 300)}...` : text
45}
46
47const jsonBody = (body: string) => Option.getOrUndefined(decodeJson(body))
48

Callers 7

assertEventFunction · 0.85
makeReplaySocketFunction · 0.85
assertClientEventFunction · 0.85
makeWebSocketExecutorFunction · 0.85
valueDiffsFunction · 0.85
headerDiffsFunction · 0.85
requestDiffFunction · 0.85

Calls 1

secretFindingsFunction · 0.85

Tested by

no test coverage detected