|
|
@@ -222,15 +222,18 @@ def _audit_booking(entries: list[dict], har_name: str) -> bool:
|
|
|
print(f' {"":>{col}} → {spec["hint"]}')
|
|
|
continue
|
|
|
|
|
|
- entry = found[key][0]
|
|
|
- hdrs = _req_headers(entry)
|
|
|
+ # Check every captured call of this endpoint, not just the first — the
|
|
|
+ # same endpoint can show more than one header value within one HAR (e.g.
|
|
|
+ # a stale value from a frontend bundle reload mid-capture), so a mismatch
|
|
|
+ # only means something if the client's value never shows up at all.
|
|
|
expected_headers = spec.get('headers', {})
|
|
|
+ all_hdrs = [_req_headers(e) for e in found[key]]
|
|
|
|
|
|
- mismatches: list[tuple[str, str, str]] = []
|
|
|
+ mismatches: list[tuple[str, str, list[str]]] = []
|
|
|
for hname, hexpected in expected_headers.items():
|
|
|
- hactual = hdrs.get(hname, '')
|
|
|
- if hactual != hexpected:
|
|
|
- mismatches.append((hname, hexpected, hactual))
|
|
|
+ observed = [h.get(hname, '') for h in all_hdrs]
|
|
|
+ if hexpected not in observed:
|
|
|
+ mismatches.append((hname, hexpected, sorted(set(observed))))
|
|
|
|
|
|
if not mismatches:
|
|
|
print(f' ✓ {key:<{col}} found')
|
|
|
@@ -238,10 +241,10 @@ def _audit_booking(entries: list[dict], har_name: str) -> bool:
|
|
|
all_ok = False
|
|
|
print(f' ✗ {key:<{col}} found with stale headers')
|
|
|
src = spec.get('source', 'the client headers')
|
|
|
- for hname, hexpected, hactual in mismatches:
|
|
|
+ for hname, hexpected, observed in mismatches:
|
|
|
print(f' {hname}')
|
|
|
- print(f' client: {hexpected}')
|
|
|
- print(f' HAR: {hactual} ← update {src}')
|
|
|
+ print(f' client: {hexpected}')
|
|
|
+ print(f' HAR saw: {observed} ← update {src}')
|
|
|
|
|
|
missing = [k for k in _BOOKING_ENDPOINTS if k not in found]
|
|
|
if not missing:
|