MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / parseRetryAfter

Function parseRetryAfter

src/lib/http.ts:695–705  ·  view source on GitHub ↗
(headerValue: string | null)

Source from the content-addressed store, hash-verified

693}
694
695export function parseRetryAfter(headerValue: string | null): number | undefined {
696 if (!headerValue) return undefined;
697 const numeric = Number(headerValue);
698 if (Number.isFinite(numeric) && numeric >= 0) return Math.ceil(numeric);
699 const date = Date.parse(headerValue);
700 if (!Number.isNaN(date)) {
701 const diffMs = date - Date.now();
702 return diffMs > 0 ? Math.ceil(diffMs / 1000) : 0;
703 }
704 return undefined;
705}
706
707/**
708 * HTTP statuses that arrive without our error envelope on transient

Callers 2

requestWithMetaMethod · 0.85
http.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected