You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Previous to this version when stubs were constructed starting with `stub_request()` if an error occurred in a pipe chain, or non-pipe flow, the stub prior to the error remained. This was not correct behavior from a logical perspective - i.e., one would expect if an error occurred that thing they were trying to do did not stick around. The new behavior as of this version deletes the stub upon any error during its creation. Under the hood we're using `withCallingHandlers` to handle different types of errors, throw warnings, etc.
7
7
8
-
###NEW FEATURES
8
+
## NEW FEATURES
9
9
10
10
* Partial matching. New functions `including()` and `excluding()` for use with `wi_th()` support partial for bodies and queries (header partial matching was already supported without any additional steps). See `?partial`. This makes it slightly to a whole lot easier to do matching depending on the HTTP request your trying to match (e.g., let's say you're trying to match against a query with 20 parameters - if you can match uniquely to it with 1 or 2 of those params, then you're all set) (#38)
11
11
* Basic auth internal work for `RequestPattern`. Shouldn't change behavior (#133)
12
12
* New features for supporting request body diffs. There are two ways to use request body diffing. First, you can toggle it on/off globally like `webmockr_configure(show_body_diff = TRUE)` or `webmockr_configure(show_body_diff = FALSE)`. Second, a new function `stub_body_diff()` is a standalone function that compares by default the last stub created and the last http request made - but you can pass in any stub and http request. Note that body diffing functionality requires the suggested package `diffobj` (#126)
13
13
* As part of the above body diffing functionality, two new functions are offered: `last_request()` and `last_stub()`, which get the last http request made and the last webmockr stub created, respectively. (#126)
14
14
15
-
###MINOR IMPROVEMENTS
15
+
## MINOR IMPROVEMENTS
16
16
17
17
* Removed `global_stubs` field from the `StubRegistry` class as it was completely unused (holdover from the initial port from Ruby). Should not impact users at all. (#127)
18
18
* Wider use of `rlang` functions throughout the package for nicer assertions and condition handling. This change alters the main error message you get when there's no match to registered stubs. Hopefully this feels like an improvement to you; let me know. (#129)
@@ -22,7 +22,7 @@ webmockr 2.0.0
22
22
webmockr 1.0.0
23
23
==============
24
24
25
-
###NEW FEATURES
25
+
## NEW FEATURES
26
26
27
27
*`webmockr` now supports the `httr2` library, in addition to `httr` and `crul`. Note that you'll see different behavior from `httr2` relative to the other 2 http clients because it turns http errors (http statuses 400 and above) into R errors (#122)
28
28
*`webmockr` can now mock async http requests with `crul` (w/ `crul` v1.5 or greater). no change was required in `webmockr` for this to happen. a PR was merged in `crul` to hook into `webmockr`. there's no support for async in `httr` as that package does not do any async and no support in `httr2` because `req_perform_parallel` does not have a mocking hook as does `req_perform` (#124)
@@ -31,37 +31,37 @@ webmockr 1.0.0
31
31
webmockr 0.9.0
32
32
==============
33
33
34
-
###BUG FIXES
34
+
## BUG FIXES
35
35
36
36
*`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
37
37
* 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
38
38
* The `status` parameter in `to_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
39
39
40
-
###MINOR IMPROVEMENTS
40
+
## MINOR IMPROVEMENTS
41
41
42
42
* Config options changes (see `webmockr_configure()`). Three options that were present 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)
43
43
44
-
###DOCUMENTATION
44
+
## DOCUMENTATION
45
45
46
46
*`StubCounter` added to pkgdown docs page at <https://docs.ropensci.org/webmockr/reference/StubCounter.html> (#119) @maelle
47
47
48
48
49
49
webmockr 0.8.2
50
50
==============
51
51
52
-
###BUG FIXES
52
+
## BUG FIXES
53
53
54
54
* change to `UriPattern` to make sure regex matching is working as intended (#114) thanks @kenahoo
55
55
56
56
57
57
webmockr 0.8.0
58
58
==============
59
59
60
-
###NEW FEATURES
60
+
## NEW FEATURES
61
61
62
62
*`enable()` and the `enable()` method on the `Adapter` R6 class gain new parameter `quiet` to toggle whether messages are printed or not (#112)
63
63
64
-
###MINOR IMPROVEMENTS
64
+
## MINOR IMPROVEMENTS
65
65
66
66
* 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)
67
67
* improve docs: add further explanation to manual files for both `to_raise()` and `to_return()` to explain the difference between them and when you may want to use them (#100)
@@ -70,33 +70,33 @@ webmockr 0.8.0
70
70
webmockr 0.7.4
71
71
==============
72
72
73
-
###MINOR IMPROVEMENTS
73
+
## MINOR IMPROVEMENTS
74
74
75
75
* 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)
76
76
77
-
###BUG FIXES
77
+
## BUG FIXES
78
78
79
79
* bug fix + improvement: fixes for simple authentication - `wi_th()` now supports `basic_auth` to mock basic authentication either with `crul::auth()` or `httr::authenticate()` (#108)
80
80
81
81
82
82
webmockr 0.7.0
83
83
==============
84
84
85
-
###NEW FEATURES
85
+
## NEW FEATURES
86
86
87
87
* 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 new `times` parameter within `to_return()`. As a related use case (#31) you can mock http retry's using this new feature (#10) (#32) (#101)
88
88
* Gains new function `webmockr_reset()` to be able to reset stub registry and request registry in one function call (#97) (#101)
89
89
* Gains support for mocking simple authentication. `wi_th()` now accepts `basic_auth` in addition to query, body, and headers. Note that authentication type is ignored (#103)
90
90
91
-
###MINOR IMPROVEMENTS
91
+
## MINOR IMPROVEMENTS
92
92
93
93
* 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". See `UriPattern` for more (#102)
94
94
* 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)
95
95
* 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)
96
96
* wasn't sure `write_disk_path` behavior was correct when using httr, seems to be working, added tests for it (#79)
97
97
* 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)
98
98
99
-
###BUG FIXES
99
+
## BUG FIXES
100
100
101
101
* fix for `uri_regex` usage in `stub_request()`: no longer curl escape the `uri_regex` given, only escape a non-regex uri (#106)
102
102
@@ -110,19 +110,19 @@ webmockr 0.6.2
110
110
webmockr 0.6.0
111
111
==============
112
112
113
-
###NEW FEATURES
113
+
## NEW FEATURES
114
114
115
115
* new `Adapter` class to consolidate common code for the `HttrAdapter` and `CrulAdapter` classes, which inherit from `Adapter`; not a user facing change (#87)
116
116
* pkgdown documentation site gains grouping of functions to help the user navigate the package: see https://docs.ropensci.org/webmockr/reference/ (#93)
117
117
118
-
###MINOR IMPROVEMENTS
118
+
## MINOR IMPROVEMENTS
119
119
120
120
* now correctly fails with informative message when `write_disk_path` is `NULL` when the user is trying to write to disk while using webmockr (#78)
121
121
* improve README construction; use html child for the details section (#81)
122
-
* fix matching stub matching for bodies when bodies are JSON encoded (#82)
122
+
* fix matching stub matching for bodies when bodies are JSON encoded (#82)
123
123
* when vcr was loaded real HTTP requests were being performed twice when they should have only been performed once (#91) (#92)
124
124
125
-
###BUG FIXES
125
+
## BUG FIXES
126
126
127
127
* fix for `set_body()` method in the `Response` class - handle cases where user writing to disk and not, and handle raw bytes correctly (#80)
128
128
* fix to `to_s()` method in `StubbedRequest` class - was formatting query parameters incorrectly (#83)
@@ -133,51 +133,51 @@ webmockr 0.6.0
133
133
webmockr 0.5.0
134
134
==============
135
135
136
-
###NEW FEATURES
136
+
## NEW FEATURES
137
137
138
138
*`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)
139
139
* gains `request_registry_clear()` method to easily clear all requests in the request registry (#75)
140
140
141
-
###MINOR IMPROVEMENTS
141
+
## MINOR IMPROVEMENTS
142
142
143
143
* better docs for R6 classes with R6 support in new roxygen2 version on cran (#77)
144
144
* httr simple auth was being ignored - its now supported (simple auth with crul already worked) (#74)
145
145
146
-
###BUG FIXES
146
+
## BUG FIXES
147
147
148
148
* fix to handle raw responses that can not be converted to character, such as images; needed due to issue https://github.com/ropensci/vcr/issues/112 (#72) (#73)
149
149
150
150
151
151
webmockr 0.4.0
152
152
==============
153
153
154
-
###MINOR IMPROVEMENTS
154
+
## MINOR IMPROVEMENTS
155
155
156
156
* fix link to http testing book, change ropensci to ropenscilabs (#67)
157
157
* 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)
158
158
159
-
###BUG FIXES
159
+
## BUG FIXES
160
160
161
161
* fix stub specification within crul and httr adapters; typo in setting headers (#70)
162
162
163
163
164
164
webmockr 0.3.4
165
165
==============
166
166
167
-
###DEFUNCT
167
+
## DEFUNCT
168
168
169
169
* underscore methods `to_return_()` and `wi_th_()` are defunct (#60) (#64)
* improved the print method for stubs, found in `StubbedRequest`, to have better behavior for very long strings such as in headers and bodies (#63)
179
179
180
-
###BUG FIXES
180
+
## BUG FIXES
181
181
182
182
* fix date in mocked `httr` response object to match the date format that `httr` uses in real HTTP requests (#58) (#61) via <https://github.com/ropensci/vcr/issues/91>
183
183
* fix response headers in mocked `httr` response objects. `httr` makes the list of headers insensitive to case, so we now use that function from the package (#59) (#61)
@@ -187,7 +187,7 @@ webmockr 0.3.4
187
187
webmockr 0.3.0
188
188
==============
189
189
190
-
###MINOR IMPROVEMENTS
190
+
## MINOR IMPROVEMENTS
191
191
192
192
* returned mocked response headers were retaining case that the user gave - whereas they should be all lowercased to match the output in `crul` and `httr`. now fixed. (#49) thanks @hlapp
193
193
* returned mocked response headers were not all of character class, but depended on what class was given by the user on creating the stub. this is now fixed, returning all character class values for response headers (#48) thanks @hlapp
@@ -198,22 +198,22 @@ webmockr 0.3.0
198
198
webmockr 0.2.9
199
199
==============
200
200
201
-
###MINOR IMPROVEMENTS
201
+
## MINOR IMPROVEMENTS
202
202
203
203
* make `request_registry()` and `stub_registry()` print methods more similar to avoid confusion for users (#35)
204
204
* update docs for `enable`/`disable` to indicate that `crul` and `httr` supported (#46) (related to #45)
205
205
* wrap httr adapter examples in `requireNamespace` so only run when httr available
206
206
* clean up `.onLoad` call, removing commented out code, and add note about creating adapter objects does not load crul and httr packages
207
207
208
-
###BUG FIXES
208
+
## BUG FIXES
209
209
210
210
* fix to `enable()` and `disable()` methods. even though `httr` is in Suggests, we were loading all adapters (crul, httr) with `stop` when the package was not found. We now give a message and skip when a package not installed. In addition, we `enable()` and `disable()` gain an `adapter` parameter to indicate which package you want to enable or disable. If `adapter` not given we attempt all adapters. Note that this bug shouldn't have affected `vcr` users as `httr` is in Imports in that package, so you'd have to have `httr` installed (#45) thanks to @maelle for uncovering the problem
211
211
212
212
213
213
webmockr 0.2.8
214
214
==============
215
215
216
-
###NEW FEATURES
216
+
## NEW FEATURES
217
217
218
218
* Added support for integration with package `httr`; see `HttrAdapter` for the details; `webmockr` now integrates with two HTTP R packages: `crul` and `httr` (#43) (#44)
219
219
* Along with `httr` integration is a new method `httr_mock()` to turn on mocking for `httr`; and two methods `build_httr_response` and `build_httr_request` meant for internal use
@@ -222,22 +222,22 @@ webmockr 0.2.8
222
222
webmockr 0.2.6
223
223
==============
224
224
225
-
###NEW FEATURES
225
+
## NEW FEATURES
226
226
227
227
* Added support for integration with package `vcr` (now on CRAN) for doing HTTP request caching
228
228
229
229
230
230
webmockr 0.2.4
231
231
==============
232
232
233
-
###NEW FEATURES
233
+
## NEW FEATURES
234
234
235
235
* New function `enabled()` to ask if `webmockr` is enabled, gives a
236
236
boolean
237
237
*`wi_th()` gains new parameter `.list` as an escape hatch to avoid
238
238
NSE. examples added in the `wi_th` man file to clarify its use
239
239
240
-
###MINOR IMPROVEMENTS
240
+
## MINOR IMPROVEMENTS
241
241
242
242
* matching by request body was not supported, it now is; added examples
243
243
of matching on request body, see `?stub_request` (#36)
@@ -248,18 +248,18 @@ pipe for users (#30)
248
248
with vcr support (#34)
249
249
* require newest `crul` version
250
250
251
-
###BUG FIXES
251
+
## BUG FIXES
252
252
253
-
* Error messages with the suggest stub were not giving bodies. They
253
+
* Error messages with the suggest stub were not giving bodies. They
254
254
now give bodies if needed along with method, uri, headers, query (#37)
255
-
* Fixed `Response` class that was not dealing with capitalization
255
+
* Fixed `Response` class that was not dealing with capitalization
256
256
correctly
257
257
258
258
259
259
webmockr 0.2.0
260
260
==============
261
261
262
-
###NEW FEATURES
262
+
## NEW FEATURES
263
263
264
264
* New function `to_raise()` to say that a matched response should return a certain exception, currently `to_raise` accepts error classes from the `fauxpas` package (#9)
265
265
* New function `to_timeout()` to say that a matched response should return a timeout. This is a special case of `to_raise` to easily do a timeout expectation (#11)
@@ -269,7 +269,7 @@ webmockr 0.2.0
269
269
*`webmockr_disable_net_connect()` now accepts an `allow` parameter to disable all other connections except those URLs given in `allow`
270
270
*`webmockr_net_connect_allowed()` now accepts a `uri` parameter to test if a URI/URL is allowed
271
271
272
-
###MINOR IMPROVEMENTS
272
+
## MINOR IMPROVEMENTS
273
273
274
274
* Fixed printed stub statement when printed to the console - we weren't including headers accurately (#18)
275
275
* Added examples to the `stub_registry()` and `stub_registry_clea()` manual files (#24)
@@ -279,11 +279,11 @@ webmockr 0.2.0
279
279
* Added linting of user inputs to the `to_return()` method, and docs details on what to input to the method
280
280
* Added linting of user inputs to the `wi_th()` method, and docs details on what to input to the method
281
281
282
-
###BUG FIXES
282
+
## BUG FIXES
283
283
284
284
* Fixed option `allow_localhost`, which wasn't actually workin before (#25)
285
285
286
-
###DEPRECATED AND DEFUNCT
286
+
## DEPRECATED AND DEFUNCT
287
287
288
288
*`webmockr_enable()` and `webmockr_disable` are now defunct. Use `webmockr::enable()` and `webmockr::disable()` instead
0 commit comments