← Back to all sparks
C

crul

ANALYTICS
Velocity0.0

R6 based http client for R (for developers). Contribute to ropensci/crul development by creating an account on GitHub.

crul took mocking back from webmockr and made it a property of the client itself

http-clientasyncmockingropenscitest-infrastructure
Current state
crul is the R6-based HTTP client underneath much of rOpenSci's package stack, covering synchronous requests, three flavours of async, pagination and retries. Its 1.6.0 release in July 2025 changed where test mocking lives: each client — HttpClient, Async, AsyncVaried — now takes a mocking parameter at initialisation or per method, and the standalone mock() function is deprecated. Mocking used to be something webmockr switched on from outside; it is now a setting on the client.
Where it's heading
The async surface has been the growth area for years — retries reached Async, AsyncVaried, AsyncQueue and HttpRequest in 1.4, AsyncQueue gained the response accessors in 1.2, and 1.5.0 wired async requests up to webmockr. The 1.6.0 change reverses that direction of dependency, and it landed within a minute of webmockr's own release severing its tie to vcr. Read together, the rOpenSci HTTP stack is being deliberately untangled so each package can be used without the others.
Prediction
With mock() deprecated rather than removed, the next major release is the likely point of deletion. Expect the remaining work to follow the same decoupling theme rather than adding request features.

Recent moves

  1. 1y ago

    Mocking becomes a client parameter, independent of webmockr

    ⚡ SPARK

    Moves mocking control into HttpClient, Async and AsyncVaried as an initialisation parameter or per-method argument, and deprecates the standalone mock() function. crul no longer needs webmockr to be in charge of whether requests are intercepted — the client decides. Published within a minute of webmockr's release cutting its own dependency on vcr.

    View source ↗
  2. 2y ago

    Async requests become mockable through webmockr

    Adds the ability to mock async requests through webmockr for both Async and AsyncVaried, closing the gap where the async paths could not be tested the way synchronous ones could. One release later this integration is what 1.6.0 replaces with client-owned mocking.

    View source ↗
  3. 2y ago

    Documentation fixes and test helper tweak

    Typo fixes, a move to the _PACKAGE documentation pattern, and a test-helper tweak. Documentation and internals only.

    View source ↗
  4. 3y ago

    HTTP retries reach the async classes

    Brings HTTP retries to the async classes — Async, AsyncVaried and AsyncQueue — and to the HttpRequest builder. Retry logic existed for synchronous requests; this closes the gap for the concurrent paths where transient failures are most likely to appear.

    View source ↗
  5. 3y ago

    Clearer error for mismatched urls and disk lengths

    Improves the error message when the urls and disk vectors passed to Async have different lengths. A clearer message for a constraint that already existed.

    View source ↗
  6. 4y ago

    AsyncQueue gains response accessors; results print as a summary

    Fills out AsyncQueue with parse, status_code, status, content and times methods so it matches the other async classes, and gives $responses() an S3 class with a print method that summarises rather than dumping every result to the console. Header parsing also gains an encoding check with a Latin-1 fallback before failing.

    View source ↗