MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseHeaders

Function parseHeaders

apps/host-selfhost/src/telemetry.ts:68–79  ·  view source on GitHub ↗
(raw: string | undefined)

Source from the content-addressed store, hash-verified

66// "k=v,k2=v2" form. A malformed pair is skipped rather than failing the boot:
67// losing traces must never cost the operator their server.
68const parseHeaders = (raw: string | undefined): Record<string, string> | undefined => {
69 const entries = (raw ?? "")
70 .split(",")
71 .map((pair) => pair.trim())
72 .filter((pair) => pair.length > 0)
73 .flatMap((pair) => {
74 const separator = pair.indexOf("=");
75 if (separator <= 0) return [];
76 return [[pair.slice(0, separator).trim(), pair.slice(separator + 1).trim()] as const];
77 });
78 return entries.length > 0 ? Object.fromEntries(entries) : undefined;
79};
80
81/**
82 * OTLP export layer for the self-hosted server, or {@link Layer.empty} when no

Callers 1

resolveTargetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected