(value: string)
| 120 | * Exported for integration use. |
| 121 | */ |
| 122 | export function parseRetryAfter(value: string): number | null { |
| 123 | // Try as integer seconds (must be non-negative) |
| 124 | const seconds = parseInt(value, 10); |
| 125 | if (!isNaN(seconds) && seconds >= 0 && String(seconds) === value.trim()) { |
| 126 | return seconds * 1000; |
| 127 | } |
| 128 | |
| 129 | // Try HTTP-date format |
| 130 | const httpDate = parseHttpDate(value); |
| 131 | if (httpDate !== null) { |
| 132 | return Math.max(0, httpDate - Date.now()); |
| 133 | } |
| 134 | |
| 135 | return null; |
| 136 | } |
| 137 | |
| 138 | function parseFirstMatch(headers: Record<string, string>, names: string[]): number | undefined { |
| 139 | for (const name of names) { |
no test coverage detected
searching dependent graphs…