Custom HTTP GET with proper User-Agent header and a bounded timeout
Source:R/globals.R
codecheck_GET.RdWraps httr::GET() with a descriptive User-Agent to avoid being
blocked by services like Figshare that reject default libcurl requests,
especially from CI runner IPs (e.g., GitHub Actions).
Arguments
- url
The URL to request
- ...
Additional arguments passed to
httr::GET()- a caller's ownhttr::timeout()here overrides the default.- timeout_seconds
Maximum time for the whole request/response cycle.
Details
Also bounds the request to timeout_seconds: plain httr::GET()
has no timeout at all, so a server that accepts the connection but never
answers (rather than erroring or rate-limiting, which
codecheck_GET_retry() already handles) hangs the request - and with
it, the whole single-threaded render - indefinitely. A render touches many
certificates across several external APIs in one run, so any one of them
having a bad moment stalls everything after it with no log output to say
why. Bounding it here means the caller gets an error back to handle
(`codecheck_GET_retry()` retries it; a bare `codecheck_GET()` caller sees a
`try`/`tryCatch`-able failure) instead of a silent, unrecoverable hang.