Skip to main content

parse_retry_after

Function parse_retry_after 

Source
pub fn parse_retry_after(raw: &str) -> Option<Duration>
Expand description

RFC 7231 section 7.1.3 Retry-After accepts either delta-seconds ("120") or an HTTP-date ("Wed, 21 Oct 2015 07:28:00 GMT"). Anthropic emits the integer form today, but the spec leaves the HTTP-date form open and proxies / CDNs in the path may swap shapes. Try the integer form first; fall back to httpdate parsing and compute the delta from now.