File size: 479 Bytes
fb4d8fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function normalizeHeaderName(name: string): string {
  return name.trim().toLowerCase();
}

export function fingerprintHeaderNames(headers: Record<string, string> | undefined): string[] {
  if (!headers) {
    return [];
  }
  const out: string[] = [];
  for (const key of Object.keys(headers)) {
    const normalized = normalizeHeaderName(key);
    if (!normalized) {
      continue;
    }
    out.push(normalized);
  }
  out.sort((a, b) => a.localeCompare(b));
  return out;
}