MCPcopy Create free account
hub / github.com/dnsimple/dnsimple-node / parseHeader

Function parseHeader

lib/fetcher/https-fetcher.ts:11–17  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

9 headers: http.IncomingHttpHeaders
10): RateLimitHeaders {
11 const parseHeader = (name: string): number | null => {
12 const value = headers[name];
13 if (value === undefined) return null;
14 const strValue = Array.isArray(value) ? value[0] : value;
15 const parsed = parseInt(strValue, 10);
16 return isNaN(parsed) ? null : parsed;
17 };
18
19 return {
20 limit: parseHeader("x-ratelimit-limit"),

Callers 1

parseRateLimitHeadersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected