MCPcopy Create free account
hub / github.com/Effect-TS/effect / retryAfterHeaderOf

Function retryAfterHeaderOf

packages/effect/src/http/HttpClient.ts:2599–2606  ·  view source on GitHub ↗
(input: unknown)

Source from the content-addressed store, hash-verified

2597 (error.reason._tag === "StatusCodeError" && isTransientResponse(error.reason.response)))
2598
2599const retryAfterHeaderOf = (input: unknown): string | undefined => {
2600 const response = Error.isHttpClientError(input)
2601 ? input.response
2602 : Predicate.hasProperty(input, HttpClientResponse.TypeId)
2603 ? input as HttpClientResponse.HttpClientResponse
2604 : undefined
2605 return response?.headers["retry-after"]
2606}
2607
2608const retryAfterOf = (input: unknown, nowMillis: number): Duration.Duration | undefined =>
2609 parseRetryAfter(nowMillis, retryAfterHeaderOf(input))

Callers 2

retryAfterOfFunction · 0.85
retryAfterAtMostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected