webmockr
Stub and set expectations on HTTP requests. Contribute to ropensci/webmockr development by creating an account on GitHub.
The stubbing library added httr2 support, then spent a year cutting itself free of everything else
◆Recent moves
- 1y ago
vcr dependency severed
Severs the mutual dependency between webmockr and vcr — two packages that previously each required the other now stand alone, with no change to how either is used. Also fixes the quiet handling in enable()/disable() and eliminates partial match warnings.
View source ↗ - 1y ago
Internal classes unexported; crul becomes an optional dependency
Unexports the internal-only R6 classes, with RequestPattern flagged as the last one still exported and due for removal next. crul moves from Imports to Suggests, with one crul call replaced by a curl equivalent so the dependency is genuinely optional unless you are mocking crul. httr2 mocking setup is also improved.
View source ↗ - 1y ago
Failed stub construction cleans up; partial matching extends to bodies and queries
Changes stub construction semantics: an error partway through building a stub now removes it rather than leaving a partial stub registered, implemented via withCallingHandlers. It also extends partial matching from headers, where it already worked, to bodies and queries through the new including() and excluding() helpers — useful when a request carries twenty query parameters and only two identify it.
View source ↗ - 2y ago
httr2 joins httr and crul as a supported client
⚡ SPARKAdds httr2 support alongside httr and crul, and picks up async mocking with crul 1.5 or later without any change on webmockr's side. The entry is candid that httr2 behaves differently because it converts HTTP statuses of 400 and above into R errors, and that parallel httr2 requests remain unmockable because req_perform_parallel offers no hook.
View source ↗ - 3y ago
Queued responses, body matching and integer status codes fixed
Repairs three matching defects at once: multiple queued responses from to_return() were broken internally, body-based stub matching failed in some cases, and to_return(status = 200L) errored despite integers being documented as acceptable. Config options that were advertised but never implemented are removed rather than left as dead surface.
View source ↗ - 3y ago
Regex URI matching fixed
A single fix to UriPattern so regex matching behaves as intended. Narrow, though URI matching is the first thing every stub relies on.
View source ↗