| 1945 | if (a !== b) throw new Error(msg ? `${msg}: expected ${b}, got ${a}` : `expected ${b}, got ${a}`); |
| 1946 | } |
| 1947 | function assertDeepEq(a, b, msg) { |
| 1948 | const aj = JSON.stringify(a); |
| 1949 | const bj = JSON.stringify(b); |
| 1950 | if (aj !== bj) throw new Error(msg ? `${msg}: expected ${bj}, got ${aj}` : `deep equal failed`); |
| 1951 | } |
| 1952 | function getHeader(headersStr, key) { |
| 1953 | const lines = (headersStr || "").split(/\r?\n/); |
| 1954 | const line = lines.find((l) => l.toLowerCase().startsWith(key.toLowerCase() + ":")); |