webmock 3.0.1 → 3.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/CI.yml +38 -0
- data/CHANGELOG.md +496 -2
- data/Gemfile +1 -1
- data/README.md +169 -34
- data/Rakefile +12 -4
- data/lib/webmock/api.rb +12 -0
- data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +221 -0
- data/lib/webmock/http_lib_adapters/curb_adapter.rb +19 -5
- data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +7 -4
- data/lib/webmock/http_lib_adapters/excon_adapter.rb +5 -2
- data/lib/webmock/http_lib_adapters/http_rb/client.rb +2 -1
- data/lib/webmock/http_lib_adapters/http_rb/request.rb +7 -1
- data/lib/webmock/http_lib_adapters/http_rb/response.rb +27 -3
- data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +9 -3
- data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +7 -3
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +28 -9
- data/lib/webmock/http_lib_adapters/manticore_adapter.rb +33 -15
- data/lib/webmock/http_lib_adapters/net_http.rb +36 -89
- data/lib/webmock/http_lib_adapters/net_http_response.rb +1 -1
- data/lib/webmock/http_lib_adapters/patron_adapter.rb +4 -4
- data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/lib/webmock/matchers/hash_including_matcher.rb +4 -23
- data/lib/webmock/rack_response.rb +1 -1
- data/lib/webmock/request_body_diff.rb +1 -1
- data/lib/webmock/request_execution_verifier.rb +2 -3
- data/lib/webmock/request_pattern.rb +129 -51
- data/lib/webmock/request_registry.rb +1 -1
- data/lib/webmock/request_signature.rb +3 -3
- data/lib/webmock/request_signature_snippet.rb +4 -4
- data/lib/webmock/request_stub.rb +15 -0
- data/lib/webmock/response.rb +19 -13
- data/lib/webmock/rspec.rb +10 -3
- data/lib/webmock/stub_registry.rb +26 -11
- data/lib/webmock/stub_request_snippet.rb +10 -6
- data/lib/webmock/test_unit.rb +1 -3
- data/lib/webmock/util/hash_counter.rb +3 -3
- data/lib/webmock/util/headers.rb +17 -2
- data/lib/webmock/util/json.rb +1 -2
- data/lib/webmock/util/query_mapper.rb +9 -7
- data/lib/webmock/util/uri.rb +10 -10
- data/lib/webmock/util/values_stringifier.rb +20 -0
- data/lib/webmock/version.rb +1 -1
- data/lib/webmock/webmock.rb +20 -3
- data/lib/webmock.rb +53 -48
- data/minitest/webmock_spec.rb +3 -3
- data/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
- data/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
- data/spec/acceptance/curb/curb_spec.rb +44 -0
- data/spec/acceptance/em_http_request/em_http_request_spec.rb +57 -1
- data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +2 -2
- data/spec/acceptance/excon/excon_spec.rb +4 -2
- data/spec/acceptance/excon/excon_spec_helper.rb +2 -0
- data/spec/acceptance/http_rb/http_rb_spec.rb +20 -0
- data/spec/acceptance/http_rb/http_rb_spec_helper.rb +5 -2
- data/spec/acceptance/httpclient/httpclient_spec.rb +8 -1
- data/spec/acceptance/manticore/manticore_spec.rb +51 -0
- data/spec/acceptance/net_http/net_http_shared.rb +47 -10
- data/spec/acceptance/net_http/net_http_spec.rb +102 -24
- data/spec/acceptance/net_http/real_net_http_spec.rb +1 -1
- data/spec/acceptance/patron/patron_spec.rb +26 -21
- data/spec/acceptance/patron/patron_spec_helper.rb +3 -3
- data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +14 -14
- data/spec/acceptance/shared/callbacks.rb +3 -2
- data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +1 -1
- data/spec/acceptance/shared/request_expectations.rb +14 -0
- data/spec/acceptance/shared/returning_declared_responses.rb +36 -15
- data/spec/acceptance/shared/stubbing_requests.rb +95 -0
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +1 -1
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +1 -1
- data/spec/support/webmock_server.rb +1 -0
- data/spec/unit/api_spec.rb +103 -3
- data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/spec/unit/request_execution_verifier_spec.rb +12 -12
- data/spec/unit/request_pattern_spec.rb +207 -49
- data/spec/unit/request_signature_snippet_spec.rb +2 -2
- data/spec/unit/request_signature_spec.rb +21 -1
- data/spec/unit/request_stub_spec.rb +35 -0
- data/spec/unit/response_spec.rb +51 -19
- data/spec/unit/stub_request_snippet_spec.rb +30 -10
- data/spec/unit/util/query_mapper_spec.rb +13 -0
- data/spec/unit/util/uri_spec.rb +74 -2
- data/spec/unit/webmock_spec.rb +108 -5
- data/test/shared_test.rb +15 -2
- data/test/test_webmock.rb +6 -0
- data/webmock.gemspec +15 -7
- metadata +86 -37
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a7e964f28dd42787fd854c5fcc87dba4cd61ef214c3dee485d9bd0d71fc1cdd
|
4
|
+
data.tar.gz: f6921a9b14ccd71f18b4674aca8d4d24bf377545a4ef8c56862f95cc56b6e8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e85d1bb83018bdaab80aed649134757ee8ac591b98e9ccf1b6df10c0d8930db167dd5fd3bb039dd56a955d22c0cc6b1a1227bb88e8f3e56d31d0e1c9d7708e
|
7
|
+
data.tar.gz: c67f1f8486d6ee932bd9d01dff2bfcec35d9c3e3ed937e50e1f56d34f664ca11db4c9399c51e82da9316245c1d4727c726b9e307646aef80477764609ecf95ee
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby:
|
16
|
+
- head
|
17
|
+
- '3.1'
|
18
|
+
- '3.0'
|
19
|
+
- '2.7'
|
20
|
+
- '2.6'
|
21
|
+
- '2.5'
|
22
|
+
- jruby
|
23
|
+
continue-on-error: ${{ matrix.ruby == 'head' }}
|
24
|
+
name: Ruby ${{ matrix.ruby }}
|
25
|
+
env:
|
26
|
+
JRUBY_OPTS: "--debug"
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- name: Install Apt Packages
|
30
|
+
run: |
|
31
|
+
sudo apt-get install libcurl4-openssl-dev -y
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
continue-on-error: true
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
bundler-cache: true
|
37
|
+
- run: |
|
38
|
+
bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,499 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 3.18.1
|
4
|
+
|
5
|
+
* Reverted simplified connection handing in Net::HTTP adapter due to https://github.com/bblimke/webmock/issues/999
|
6
|
+
|
7
|
+
# 3.18.0
|
8
|
+
|
9
|
+
* Net::BufferedIO is not replaced anymore.
|
10
|
+
|
11
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
12
|
+
|
13
|
+
* Simplified connection handing in Net::HTTP adapter.
|
14
|
+
|
15
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
16
|
+
|
17
|
+
# 3.17.1
|
18
|
+
|
19
|
+
* Fixed Syntax Error
|
20
|
+
|
21
|
+
Thanks to [Mark Spangler](https://github.com/mspangler)
|
22
|
+
|
23
|
+
# 3.17.0
|
24
|
+
|
25
|
+
* Minimum required Ruby version is 2.3
|
26
|
+
|
27
|
+
Thanks to [Go Sueyoshi](https://github.com/sue445)
|
28
|
+
|
29
|
+
* When using Net::HTTP, stubbed socket StubSocket#close and StubSocket#closed? behave more like the real sockets.
|
30
|
+
|
31
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
32
|
+
|
33
|
+
* Added `peeraddr`, `ssl_version` and `cipher` methods to stubbed sockets used by Net::HTTP.
|
34
|
+
|
35
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
36
|
+
|
37
|
+
* Added support for matching top-level array in JSON request body.
|
38
|
+
|
39
|
+
E.g.
|
40
|
+
|
41
|
+
````
|
42
|
+
stub_request(:post, 'www.example.com').with(body: [{a: 1}])
|
43
|
+
````
|
44
|
+
|
45
|
+
Thanks to [Cedric Sohrauer](https://github.com/cedrics)
|
46
|
+
|
47
|
+
# 3.16.2
|
48
|
+
|
49
|
+
* Minimum required Ruby version is 2.0.
|
50
|
+
|
51
|
+
# 3.16.0 (yanked)
|
52
|
+
|
53
|
+
* Fix leaky file descriptors and reuse socket for persistent connections.
|
54
|
+
|
55
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
56
|
+
|
57
|
+
* Allow specifying for what URIs or hosts, Net::HTTP should connect on start.
|
58
|
+
|
59
|
+
Thanks to [Ray Zane](https://github.com/rzane)
|
60
|
+
|
61
|
+
# 3.15.2
|
62
|
+
|
63
|
+
* Minimum required Ruby version is 2.0.
|
64
|
+
|
65
|
+
# 3.15.0 (yanked)
|
66
|
+
|
67
|
+
* fixed async-http adapter on Windows
|
68
|
+
|
69
|
+
Thanks to [Pavel Rosický](https://github.com/ahorek)
|
70
|
+
|
71
|
+
* Support for http.rb >= 5.0.2
|
72
|
+
|
73
|
+
Thanks to [ojab](https://github.com/ojab)
|
74
|
+
|
75
|
+
* Curb adapter supports headers with `:` character in the header value
|
76
|
+
|
77
|
+
Thanks to [Giorgio Gambino](https://github.com/mrbuzz)
|
78
|
+
|
79
|
+
* Support for matching body of JSON or application/x-www-form-urlencoded requests with content type header including charset.
|
80
|
+
|
81
|
+
Thanks to [Timmitry](https://github.com/Timmitry)
|
82
|
+
|
83
|
+
* Prevent double-wrapping http.rb features on non-stubbed requests
|
84
|
+
|
85
|
+
Thanks to [Michael Fairley](https://github.com/michaelfairley)
|
86
|
+
|
87
|
+
# 3.14.0
|
88
|
+
|
89
|
+
* Bump Addressable from 2.3.6 to 2.8.0
|
90
|
+
|
91
|
+
Thanks to [Eduardo Hernandez](https://github.com/EduardoGHdez)
|
92
|
+
|
93
|
+
# 3.13.0
|
94
|
+
|
95
|
+
* Support http.rb 5.x
|
96
|
+
|
97
|
+
Thanks to [Will Storey](https://github.com/horgh)
|
98
|
+
|
99
|
+
# 3.12.2
|
100
|
+
|
101
|
+
* Fixed em-http-request adapter to avoid calling middleware twice.
|
102
|
+
|
103
|
+
Thanks to [Alex Vondrak](https://github.com/ajvondrak)
|
104
|
+
|
105
|
+
# 3.12.1
|
106
|
+
|
107
|
+
* Fixed handling of URIs with IPv6 addresses with square brackets when in Net::HTTP adapter.
|
108
|
+
|
109
|
+
Thanks to [Johanna Hartmann](https://github.com/JohannaHartmann)
|
110
|
+
|
111
|
+
# 3.12.0
|
112
|
+
|
113
|
+
* Added support for handling custom JSON and XML content types e.g. 'application/vnd.api+json'
|
114
|
+
|
115
|
+
# 3.11.3
|
116
|
+
|
117
|
+
* Fixed async-http adapter to only considered requests as real if they are real.
|
118
|
+
|
119
|
+
Thanks to Thanks to [Tony Schneider](https://github.com/tonywok) and [Samuel Williams](https://github.com/ioquatix)
|
120
|
+
|
121
|
+
# 3.11.2
|
122
|
+
|
123
|
+
* Fix for Manticore streaming mode
|
124
|
+
|
125
|
+
Thanks to [Oleksiy Kovyrin](https://github.com/kovyrin)
|
126
|
+
|
127
|
+
# 3.11.1
|
128
|
+
|
129
|
+
* Compatibility with async-http 0.54+
|
130
|
+
|
131
|
+
Thanks to [Jun Jiang](https://github.com/jasl)
|
132
|
+
|
133
|
+
# 3.11.0
|
134
|
+
|
135
|
+
* Added support for `features` in http.rb adapter.
|
136
|
+
|
137
|
+
Thanks to [Carl (ce07c3)](https://github.com/ce07c3)
|
138
|
+
|
139
|
+
# 3.10.0
|
140
|
+
|
141
|
+
* Added option to global stubs to have lower priority than local stubs.
|
142
|
+
|
143
|
+
WebMock.globally_stub_request(:after_local_stubs) do
|
144
|
+
{ body: "global stub body" }
|
145
|
+
end
|
146
|
+
|
147
|
+
stub_request(:get, "www.example.com").to_return(body: 'non-global stub body')
|
148
|
+
|
149
|
+
expect(http_request(:get, "http://www.example.com/").body).to eq("non-global stub body")
|
150
|
+
|
151
|
+
Thanks to [Marek Kasztelnik](https://github.com/mkasztelnik)
|
152
|
+
|
153
|
+
# 3.9.5
|
154
|
+
|
155
|
+
* Prevent overwriting `teardown` method in Test::Unit
|
156
|
+
|
157
|
+
Thanks to [Jesse Bowes](https://github.com/jessebs)
|
158
|
+
|
159
|
+
# 3.9.4
|
160
|
+
|
161
|
+
* More intuitive error message when stubbed response body was provided as Hash
|
162
|
+
|
163
|
+
Thanks to [Ben Koshy](https://github.com/BKSpurgeon)
|
164
|
+
|
165
|
+
# 3.9.3
|
166
|
+
|
167
|
+
* Make httpclient_adapter thread-safe
|
168
|
+
|
169
|
+
Thanks to [Adam Harwood](https://github.com/adam-harwood)
|
170
|
+
|
171
|
+
# 3.9.2
|
172
|
+
|
173
|
+
* Made global stubs thread-safe
|
174
|
+
|
175
|
+
Thanks to [Adam Harwood](https://github.com/adam-harwood)
|
176
|
+
|
177
|
+
# 3.9.1
|
178
|
+
|
179
|
+
* Fixed support for passing `URI` objects as second argument of `stub_request`
|
180
|
+
|
181
|
+
Thanks to [Ryan Kerr](https://github.com/leboshi)
|
182
|
+
|
183
|
+
## 3.9.0
|
184
|
+
|
185
|
+
* Allow using a "callable" (like a proc) as URI pattern
|
186
|
+
|
187
|
+
stub_request(:any, ->(uri) { true })
|
188
|
+
|
189
|
+
Thanks to [John Hawthorn](https://github.com/jhawthorn)
|
190
|
+
|
191
|
+
* Added stubbed IO on stubbed socket in Net::HTTP adapter.
|
192
|
+
|
193
|
+
Thanks to [Thilo Rusche](https://github.com/trusche)
|
194
|
+
|
195
|
+
* When 'webmock/rspec' is required, reset WebMock after all after(:each/example) hooks
|
196
|
+
|
197
|
+
Thanks to [Andrew Stuntz](https://github.com/drews256)
|
198
|
+
|
199
|
+
* Fixed `net_connect_allowed?` when invoked with no arguments, when there were any allowed URIs passed to `disable_net_connect?`.
|
200
|
+
|
201
|
+
Thanks to [Lucas Uyezu](https://github.com/lucasuyezu)
|
202
|
+
|
203
|
+
* Fixed async-http adapter which caused Async::HTTP::Client or Async::HTTP::Internet to hang and never return a response.
|
204
|
+
|
205
|
+
Thanks to [Bruno Sutic](https://github.com/bruno-) and [Samuel Williams](https://github.com/ioquatix)
|
206
|
+
|
207
|
+
* Fixed warning when using async-http adapter
|
208
|
+
|
209
|
+
Thanks to [Bruno Sutic](https://github.com/bruno-)
|
210
|
+
|
211
|
+
* Dropped support for Ruby 2.3 - EOL date: 2019-03-31
|
212
|
+
|
213
|
+
* Dropped support for Ruby 2.4 - EOL date: 2020-03-31
|
214
|
+
|
215
|
+
* Handling matching of Addressable::Template patterns that have an ip address without port and patterns that have ip address and don’t have schema and path.
|
216
|
+
|
217
|
+
Thanks to [Rafael França](https://github.com/rafaelfranca) and [guppy0356](https://github.com/guppy0356)
|
218
|
+
|
219
|
+
## 3.8.3
|
220
|
+
|
221
|
+
* Fixed problem introduced in version 3.4.2, which caused matching against Addressable::Template representing host part of the URI to raise an error.
|
222
|
+
|
223
|
+
Thanks to [Vesa Laakso](https://github.com/valscion)
|
224
|
+
|
225
|
+
## 3.8.2
|
226
|
+
|
227
|
+
* Support correct encoding parameter for HTTP.rb 2.x and earlier
|
228
|
+
|
229
|
+
Thanks to [Alex Coomans](https://github.com/drcapulet)
|
230
|
+
|
231
|
+
## 3.8.1
|
232
|
+
|
233
|
+
* Added support for mocking non-ASCII bodies when making requests with HTTP.rb
|
234
|
+
|
235
|
+
Thanks to [Patrik Ragnarsson](https://github.com/dentarg)
|
236
|
+
|
237
|
+
## 3.8.0
|
238
|
+
|
239
|
+
* Fixed options handling when initialising Async::HTTP::Client
|
240
|
+
|
241
|
+
Thanks to [Samuel Williams](https://github.com/ioquatix)
|
242
|
+
|
243
|
+
* Ruby 2.7 support.
|
244
|
+
|
245
|
+
Thanks to [Ryan Davis](https://github.com/zenspider) and [Brandur](https://github.com/brandur)
|
246
|
+
|
247
|
+
## 3.7.6
|
248
|
+
|
249
|
+
* Suppressed keyword argument warnings in Ruby 2.7 in async-http adapter.
|
250
|
+
|
251
|
+
Thanks to [Koichi ITO](https://github.com/koic)
|
252
|
+
|
253
|
+
## 3.7.5
|
254
|
+
|
255
|
+
* Suppress Excon warning generated by extra key
|
256
|
+
|
257
|
+
Thanks to [Marco Costa](https://github.com/marcotc)
|
258
|
+
|
259
|
+
## 3.7.4
|
260
|
+
|
261
|
+
* Resetting memoized response fields in Curb adapter.
|
262
|
+
|
263
|
+
Thanks to [Andrei Sidorov](https://github.com/heretge)
|
264
|
+
|
265
|
+
## 3.7.3
|
266
|
+
|
267
|
+
* Fix for http.rb. Allow passing an output buffer to HTTP::Response::Body#readpartial
|
268
|
+
|
269
|
+
Thanks to [George Claghorn](https://github.com/georgeclaghorn)
|
270
|
+
|
271
|
+
* Fixed Manticore adapter to invoke Manticore failure handler on stubbed timeout
|
272
|
+
|
273
|
+
Thanks to [Alex Junger](https://github.com/alexJunger)
|
274
|
+
|
275
|
+
* Added project metadata to the gemspec
|
276
|
+
|
277
|
+
Thanks to [Orien Madgwick](https://github.com/orien)
|
278
|
+
|
279
|
+
## 3.7.2
|
280
|
+
|
281
|
+
* Fixed handling of non UTF-8 encoded urls
|
282
|
+
|
283
|
+
Thanks to [Rafael França](https://github.com/rafaelfranca)
|
284
|
+
|
285
|
+
* Fixed "shadowing outer local variable" warning
|
286
|
+
|
287
|
+
Thanks to [y-yagi](https://github.com/y-yagi)
|
288
|
+
|
289
|
+
## 3.7.1
|
290
|
+
|
291
|
+
* Fixed Async::HTTP::Client adapter code to not cause Ruby warning
|
292
|
+
|
293
|
+
Thanks to [y-yagi](https://github.com/y-yagi)
|
294
|
+
|
295
|
+
## 3.7.0
|
296
|
+
|
297
|
+
* Support for Async::HTTP::Client
|
298
|
+
|
299
|
+
Thanks to [Andriy Yanko](https://github.com/ayanko)
|
300
|
+
|
301
|
+
## 3.6.2
|
302
|
+
|
303
|
+
* Fixed Patron adapter to handle HTTP/2 status line.
|
304
|
+
|
305
|
+
Thanks to [Fábio D. Batista](https://github.com/fabiob)
|
306
|
+
|
307
|
+
## 3.6.1
|
308
|
+
|
309
|
+
* Fixed issue with matching Addressable::Template without a period in the domain
|
310
|
+
|
311
|
+
Thanks to [Eike Send](https://github.com/eikes)
|
312
|
+
|
313
|
+
* Support for `write_timeout` in Net::HTTP
|
314
|
+
|
315
|
+
Thanks to [Claudio Poli](https://github.com/masterkain)
|
316
|
+
|
317
|
+
* Fixed issue with handling urls with ":80" or ":443" in the path.
|
318
|
+
|
319
|
+
Thanks to [Csaba Apagyi](https://github.com/thisismydesign) for reporting and to [Frederick Cheung](https://github.com/fcheung) for fixing the issue.
|
320
|
+
|
321
|
+
## 3.6.0
|
322
|
+
|
323
|
+
* Compatibility with the latest version of hashdiff gem, with constant changed from HashDiff to Hashdiff
|
324
|
+
|
325
|
+
Thanks to [Jeff Felchner](https://github.com/jfelchner)
|
326
|
+
|
327
|
+
* Added a hint to the error message raised when `with` method is called without args or a block.
|
328
|
+
|
329
|
+
Thanks to [Adam Sokolnicki](https://github.com/asok)
|
330
|
+
|
331
|
+
* Resetting configured HTTP method in Curb adapter after each request
|
332
|
+
|
333
|
+
Thanks to [tiendo1011](https://github.com/tiendo1011)
|
334
|
+
|
335
|
+
* Added `WebMock.enable_net_connect!` as an alias for `WebMock.allow_net_connect!`
|
336
|
+
and `WebMock.disallow_net_connect!` as an alias for `WebMock.disable_net_connect!`
|
337
|
+
|
338
|
+
Thanks to [SoonKhen OwYong](https://github.com/owyongsk)
|
339
|
+
|
340
|
+
* Fixed handling of empty arrays as query params when using Faraday
|
341
|
+
|
342
|
+
Thanks to [Ryan Moret](https://github.com/rcmoret)
|
343
|
+
|
344
|
+
## 3.5.1
|
345
|
+
|
346
|
+
* Disabling TracePoint defined in Net::BufferedIO in case of exception being raised.
|
347
|
+
|
348
|
+
Thanks to [Koichi Sasada](https://github.com/ko1)
|
349
|
+
|
350
|
+
|
351
|
+
## 3.5.0
|
352
|
+
|
353
|
+
* Ruby 2.6.0 support
|
354
|
+
|
355
|
+
Thanks to [Arkadiy Tetelman](https://github.com/arkadiyt)
|
356
|
+
|
357
|
+
* Added `WebMock.reset_executed_requests!` method.
|
358
|
+
|
359
|
+
stub_get = stub_request(:get, "www.example.com")
|
360
|
+
Net::HTTP.get('www.example.com', '/')
|
361
|
+
WebMock::RequestRegistry.instance.times_executed(stub_get.request_pattern) # => 1
|
362
|
+
reset_executed_requests!
|
363
|
+
WebMock::RequestRegistry.instance.times_executed(stub_get.request_pattern) # => 0
|
364
|
+
|
365
|
+
Thanks to [Olia Kremmyda](https://github.com/oliakremmyda)
|
366
|
+
|
367
|
+
* Performance improvements
|
368
|
+
|
369
|
+
Thanks to [Pavel Rosický](https://github.com/ahorek)
|
370
|
+
|
371
|
+
## 3.4.2
|
372
|
+
|
373
|
+
* Fixed `rbuf_fill` in Net::HTTP adapter to be thread-safe
|
374
|
+
|
375
|
+
Thanks to [Arkadiy Tetelman](https://github.com/arkadiyt)
|
376
|
+
|
377
|
+
* Fix invalid scheme error with Addressable::Template
|
378
|
+
|
379
|
+
Thanks to [Kazato Sugimoto](https://github.com/uiureo)
|
380
|
+
|
381
|
+
## 3.4.1
|
382
|
+
|
383
|
+
* When comparing url encoded body to a body from request stub, which was declared as hash, only String, Numeric and boolean hash values are stringified before the comparison.
|
384
|
+
|
385
|
+
Thanks to [Lukas Pokorny](https://github.com/luk4s)
|
386
|
+
|
387
|
+
## 3.4.0
|
388
|
+
|
389
|
+
* Ruby 2.6 support. Prevent `Net/ReadTimeout` error in Ruby 2.6
|
390
|
+
|
391
|
+
Thanks to [Koichi ITO](https://github.com/koic)
|
392
|
+
|
393
|
+
* Handling query params, which represent nested hashes with keys starting with non word characters.
|
394
|
+
|
395
|
+
Thanks to [rapides](https://github.com/rapides) for reporting the issue.
|
396
|
+
|
397
|
+
* Patron adapter handles PATCH requests with body.
|
398
|
+
|
399
|
+
Thanks to [Mattia](https://github.com/iMacTia) for reporting the issue.
|
400
|
+
|
401
|
+
* Allowing requests with url encoded body to be matched by request stubs declared with hash body with non-string values.
|
402
|
+
|
403
|
+
stub_request(:post, "www.example.com").with(body: {"a" => 1, "b" => false})
|
404
|
+
|
405
|
+
RestClient.post('www.example.com', 'a=1&b=false', :content_type => 'application/x-www-form-urlencoded') # ===> Success
|
406
|
+
|
407
|
+
Thanks to [Kenny Ortmann](https://github.com/yairgo) for suggesting this feature.
|
408
|
+
|
409
|
+
* When request headers contain 'Accept'=>'application/json' and no registered stub matches the request, WebMock prints a suggested stub code with to_return body set to '{}'.
|
410
|
+
|
411
|
+
Thanks to [redbar0n](https://github.com/redbar0n)
|
412
|
+
|
413
|
+
* Improved suggested stub output when the request stub only contains headers declaration.
|
414
|
+
|
415
|
+
Thanks to [Olia Kremmyda](https://github.com/oliakremmyda)
|
416
|
+
|
417
|
+
* Fixed Curb adapter to handle `reset` method.
|
418
|
+
|
419
|
+
Thanks tp [dinhhuydh](https://github.com/dinhhuydh) for reporting the issue.
|
420
|
+
Thanks to [Olia Kremmyda](https://github.com/oliakremmyda) for fixing it.
|
421
|
+
|
422
|
+
|
423
|
+
## 3.3.0
|
424
|
+
|
425
|
+
* Better formatting of outputted request stub snippets, displayed on failures due to unstubbed requests.
|
426
|
+
|
427
|
+
Thanks to [Olia Kremmyda](https://github.com/oliakremmyda)
|
428
|
+
|
429
|
+
|
430
|
+
## 3.2.1
|
431
|
+
|
432
|
+
* Fixed Ruby warning under Ruby 2.5
|
433
|
+
|
434
|
+
Thanks to [Matt Brictson](https://github.com/mattbrictson)
|
435
|
+
|
436
|
+
|
437
|
+
## 3.2.0
|
438
|
+
|
439
|
+
* Automatically disable WebMock after Rspec suite
|
440
|
+
|
441
|
+
Thanks to [Michał Matyas](https://github.com/d4rky-pl)
|
442
|
+
|
443
|
+
* Fixed bug when handling redirection using Curb.
|
444
|
+
|
445
|
+
Thanks to [Olia Kremmyda](https://github.com/oliakremmyda)
|
446
|
+
|
447
|
+
|
448
|
+
## 3.1.1
|
449
|
+
|
450
|
+
* Warning message is displayed only once when adding query params to URIAddressablePattern.
|
451
|
+
|
452
|
+
## 3.1.0
|
453
|
+
|
454
|
+
* http.rb 3.0.0 compatibility
|
455
|
+
|
456
|
+
Thanks to [Piotr Boniecki](https://github.com/Bonias)
|
457
|
+
|
458
|
+
* Typhoeus 1.3.0 support
|
459
|
+
|
460
|
+
Thanks to [NARUSE, Yui](https://github.com/nurse)
|
461
|
+
|
462
|
+
* Added support for matching partial query params using hash_excluding
|
463
|
+
|
464
|
+
stub_request(:get, "www.example.com").
|
465
|
+
with(query: hash_excluding({"a" => "b"}))
|
466
|
+
|
467
|
+
RestClient.get("http://www.example.com/?a=b") # ===> Failure
|
468
|
+
RestClient.get("http://www.example.com/?a=c") # ===> Success
|
469
|
+
|
470
|
+
Thanks to [Olexandr Hoshylyk](https://github.com/Warrior109)
|
471
|
+
|
472
|
+
* Added MRI 2.3+ frozen string literal compatibility
|
473
|
+
|
474
|
+
Thanks to [Pat Allan](https://github.com/pat)
|
475
|
+
|
476
|
+
* Ensured that HTTPClient adapter does not yield block on empty response body if a block is provided
|
477
|
+
|
478
|
+
Thanks to [NARUSE, Yui](https://github.com/nurse)
|
479
|
+
|
480
|
+
* Fixed issue with `to_timeout` incorrectly raising `HTTP::ConnectionError` instead of `HTTP::TimeoutError` when using http.rb
|
481
|
+
|
482
|
+
Thanks to [Rick Song](https://github.com/RickCSong)
|
483
|
+
|
484
|
+
* Fixed problem with `response.connection.close` method being undefined when using http.rb
|
485
|
+
|
486
|
+
Thanks to [Janko Marohnić](https://github.com/janko-m)
|
487
|
+
|
488
|
+
* Fixed problem with matching Net::HTTP request header values assigned as numbers.
|
489
|
+
|
490
|
+
Thanks to [Felipe Constantino de Oliveira](https://github.com/felipecdo) for reporting the issue.
|
491
|
+
|
492
|
+
* Fixed problem with Net::HTTP adapter converting empty response body to nil for non 204 responses.
|
493
|
+
|
494
|
+
Thanks to [Jeffrey Charles](https://github.com/jeffcharles) for reporting the issue.
|
495
|
+
|
496
|
+
|
3
497
|
## 3.0.1
|
4
498
|
|
5
499
|
* Suppressed \`warning: \`&' interpreted as argument prefix\`
|
@@ -195,9 +689,9 @@
|
|
195
689
|
* `WebMock.disable_net_connect` accepts `:allow` option with an object that responds to `#call`, receiving a `URI` object and returning a boolean:
|
196
690
|
|
197
691
|
|
198
|
-
|
692
|
+
denylist = ['google.com', 'facebook.com', 'apple.com']
|
199
693
|
allowed_sites = lambda{|uri|
|
200
|
-
|
694
|
+
denylist.none?{|site| uri.host.include?(site) }
|
201
695
|
}
|
202
696
|
WebMock.disable_net_connect!(:allow => allowed_sites)
|
203
697
|
|
data/Gemfile
CHANGED