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

Function headerDiffs

packages/http-recorder/src/matching.ts:65–71  ·  view source on GitHub ↗
(expected: Record<string, string>, received: Record<string, string>)

Source from the content-addressed store, hash-verified

63}
64
65const headerDiffs = (expected: Record<string, string>, received: Record<string, string>) =>
66 [...new Set([...Object.keys(expected), ...Object.keys(received)])].toSorted().flatMap((key) => {
67 if (expected[key] === received[key]) return []
68 if (expected[key] === undefined) return [` ${key} unexpected ${safeText(received[key])}`]
69 if (received[key] === undefined) return [` ${key} missing expected ${safeText(expected[key])}`]
70 return [` ${key} expected ${safeText(expected[key])}, received ${safeText(received[key])}`]
71 })
72
73export const requestDiff = (expected: RequestSnapshot, received: RequestSnapshot): ReadonlyArray<string> => {
74 const lines: string[] = []

Callers 1

requestDiffFunction · 0.85

Calls 1

safeTextFunction · 0.85

Tested by

no test coverage detected