Releases: ropensci/webmockr
Releases · ropensci/webmockr
webmockr v1.0.0
NEW FEATURES
webmockr
now supports thehttr2
library, in addition tohttr
andcrul
. Note that you'll see different behavior fromhttr2
relative to the other 2 http clients because it turns http errors (http statuses 400 and above) into R errors (#122)webmockr
can now mock async http requests withcrul
(w/crul
v1.5 or greater). no change was required inwebmockr
for this to happen. a PR was merged incrul
to hook intowebmockr
. there's no support for async inhttr
as that package does not do any async and no support inhttr2
becausereq_perform_parallel
does not have a mocking hook as doesreq_perform
(#124)
webmockr v0.9.0
BUG FIXES
to_return()
supports returning multiple responses to match many requests to the same matching stub. however, the internals were broken for this, but is now fixed (#115) thanks @kenahoo for the report- matching stubs with specifying a request body to match on (e.g.,
stub_request('post', 'https://httpbin.org/post') %>% wi_th(body = list(a=5))
) was not working in some cases; internal matching logic was borked. now fixed. (#118) thanks @konradoberwimmer for the report - The
status
parameter into_return()
was documented to accept an integer, but it errored when an integer was passed (e.g.,to_return(status=200L)
). This bug is now fixed (#117) thanks @maelle for the report
MINOR IMPROVEMENTS
- Config options changes (see
webmockr_configure()
). Three options that were presentg but not implemented are now removed:show_body_diff
,query_values_notation
,net_http_connect_on_start
. One option that was present but not implemented yet is now implemented:show_stubbing_instructions
(#27) (#120)
DOCUMENTATION
StubCounter
added to pkgdown docs page at https://docs.ropensci.org/webmockr/reference/StubCounter.html (#119) @maelle
webmockr v0.8.2
webmockr v0.8.0
NEW FEATURES
enable()
and theenable()
method on theAdapter
R6 class gain new parameterquiet
to toggle whether messages are printed or not (#112)
MINOR IMPROVEMENTS
- to re-create http response objects for both httr and crul we were using the url from the request object; now we use the url from the response object, BUT if there is no url in the response object we fall back to using the url from the request object (#110) (#113)
- improve docs: add further explanation to manual files for both
to_raise()
andto_return()
to explain the differenc between them and when you may want to use them (#100)
webmockr v0.7.4
MINOR IMPROVEMENTS
- to support vcr being able to recreate httr objects fully (see github issue ropensci/vcr#132) we needed to handle additional parts of httr request objects: fields and output - with this change vcr should return objects much closer to what real httr requests return (#109)
BUG FIXES
- bug fix + improvement: fixes for simple authentication -
wi_th()
now supportsbasic_auth
to mock basic authentication either withcrul::auth()
orhttr::authenticate()
(#108)
webmockr v0.7.0
NEW FEATURES
- Gains ability to define more than 1 returned HTTP response, and the order in which the HTTP responses are returned. The idea is from the Ruby webmock library, but the implementation is different because the Ruby and R languages are very different. You can give more than one
to_return()
one creating a stub, or if you want to return the same response each time, you can use the newtimes
parameter withinto_return()
. As a related use case (#31) you can mock http retry's using this new feature (#10) (#32) (#101) - Gains new function
webmockr_reset()
to be able to reset stub registry and request registry in one function call (#97) (#101) - Gains support for mocking simple authentication.
wi_th()
now acceptsbasic_auth
in addition to query, body, and headers. Note that authentication type is ignored (#103)
MINOR IMPROVEMENTS
- change to how URI's are matched in
stub_request()
: we weren't allowing matching URI's without schemes; you can now do that. In addition, webmockr can match URI's without the "http" scheme, but does not match if the scheme is "https". SeeUriPattern
for more (#102) - another change to how URI's are matched: now query params compared separately to the URI; note that regex not allowed in query params (#104) - And now query parameters are compared with the same code both when regex uri is used and when it is not (#107)
- URI matching for stubs is now done only on the URI's themselves; that is, query parameters are removed before comparison, so only the base url with http scheme, plus paths, are compared (#107)
- wasn't sure
write_disk_path
behavior was correct when using httr, seems to be working, added tests for it (#79) - values for query parameters given to
wi_th()
are now all coerced to character class to make sure that all comparisons of stubs and requests are done with the same class (character) (#107)
BUG FIXES
- fix for
uri_regex
usage instub_request()
: no longer curl escape theuri_regex
given, only escape a non-regex uri (#106)
webmockr v0.6.2
webmockr v0.6.0
NEW FEATURES
- new
Adapter
class to consolidate common code for theHttrAdapter
andCrulAdapter
classes, which inherit fromAdapter
; not a user facing change (#87) - pkgdown documentation site gains grouping of functions to help the user navigate the package: see https://docs.ropensci.org/webmockr/reference/ (#93)
MINOR IMPROVEMENTS
- now correctly fails with informative message when
write_disk_path
isNULL
when the user is trying to write to disk while using webmockr (#78) - improve README construction; use html child for the details section (#81)
- fix matching stub matching for bodies when bodies are JSON encoded (#82)
- when vcr was loaded real HTTP requests were being performed twice when they should have only been performed once (#91) (#92)
BUG FIXES
- fix for
set_body()
method in theResponse
class - handle cases where user writing to disk and not, and handle raw bytes correctly (#80) - fix to
to_s()
method inStubbedRequest
class - was formatting query parameters incorrectly (#83) - fix to
BodyPattern
class to handle upload objects in a list; related issue fixed wherewi_th()
parameterbody
was not handling upload objects (#84) (#85) - httr requests were failing when vcr loaded, but with no cassette inserted; fixed
handle_request()
to skip vcr-related code unless a cassette is inserted (#86) (#88)
webmockr v0.5.0
NEW FEATURES
webmockr
now supports mocking writing to disk. TLDR: see?mocking-disk-writing
to get started - That is, both of the major high level http clients in R, crul and httr, support writing directly to disk (rather than the user manually getting the http response and writing it to disk). supporting this required quite a bit of work, both in code and in thinking about how to support the various scenarios in which users can find themselves when dealing with writing to disk - Please get in touch if you have problems with this (#57) (#76)- gains
request_registry_clear()
method to easily clear all requests in the request registry (#75)
MINOR IMPROVEMENTS
- better docs for R6 classes with R6 support in new roxygen2 version on cran (#77)
- httr simple auth was being ignored - its now supported (simple auth with crul already worked) (#74)
BUG FIXES
- fix to handle raw responses that can not be converted to character, such as images; needed due to issue ropensci/vcr#112 (#72) (#73)
webmockr v0.4.0
MINOR IMPROVEMENTS
- fix link to http testing book, change ropensci to ropenscilabs (#67)
- fixes to request matching: single match types working now (e.g., just match on query, or just on headers); in addition, header matching now works; added examples of single match types (#68) (#69)
BUG FIXES
- fix stub specification within crul and httr adapters; typo in setting headers (#70)