Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

602 B
Raw Blame
// The router reports internal processing milliseconds when requested with true.
export function serverLatency(headers) {
  const entry=Object.entries(headers||{}).find(([name])=>name.toLowerCase()==='x-hs-latency');
  if(!entry||typeof entry[1]!=='string')return null;
  const text=entry[1].trim();
  if(!/^\d+(?:\.\d+)?$/.test(text))return null;
  const value=Number(text);return Number.isFinite(value)?value:null;
}
export function latencyHeaders(headers) {
  return {...Object.fromEntries(Object.entries(headers||{}).filter(([name])=>name.toLowerCase()!=='x-hs-latency')),'x-hs-latency':'true'};
}