Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 301 lines (172 sloc) 11.209 kb
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
1 #Changelog
2
6eb8bb5 @bblimke WebMock tries to use already loaded version of RSpec (1.x or 2.x) (previ...
authored
3 ## Master
4
c646491 @bblimke :allow_localhost => true' now permits 0.0.0.0 in addition to 127.0.0.1 a...
authored
5 * :allow_localhost => true' now permits 0.0.0.0 in addition to 127.0.0.1 and 'localhost'. Thanks to Myron Marston and Mike Gehard for suggesting this.
6
6eb8bb5 @bblimke WebMock tries to use already loaded version of RSpec (1.x or 2.x) (previ...
authored
7 * Fixed issue with both Rspec 1.x and 2.x being available.
8
9 WebMock now tries to use already loaded version of RSpec (1.x or 2.x). Previously it was loading Rspec 2.0 if available, even if RSpec 1.3 was already loaded.
10
11 Thanks to Hans de Graaff for reporting this.
12
67a0819 @bblimke Version 1.3.5 changelog + updated docs
authored
13 ## 1.3.5
14
15 * External requests can be disabled while allowing selected hosts. Thanks to Charles Li and Ryan Bigg
16
17 This feature was available before only for localhost with `:allow_localhost => true`
18
19 WebMock.disable_net_connect!(:allow => "www.example.org")
20
21 Net::HTTP.get('www.something.com', '/') # ===> Failure
22
23 Net::HTTP.get('www.example.org', '/') # ===> Allowed.
24
25 * Fixed Net::HTTP adapter so that it preserves the original behavior of Net::HTTP.
26
27 When making a request with a block that calls #read_body on the request,
28 Net::HTTP causes the body to be set to a Net::ReadAdapter, but WebMock was causing the body to be set to a string.
29
688e687 Version 1.3.4 changelog
Bartosz Blimke and Oliver Nightingale authored
30 ## 1.3.4
31
32 * Fixed Net::HTTP adapter to handle cases where a block with `read_body` call is passed to `request`.
33 This fixes compatibility with `open-uri`. Thanks to Mark Evans for reporting the issue.
34
db5fcf4 Version 1.3.3 changelog.
Bartosz Blimke and Ben Pickles authored
35 ## 1.3.3
36
37 * Fixed handling of multiple values for the same response header for Net::HTTP. Thanks to Myron Marston for reporting the issue.
38
27c0f65 Version 1.3.2 changelog
Bartosz Blimke and Ben Pickles authored
39 ## 1.3.2
40
41 * Fixed compatibility with EM-HTTP-Request >= 0.2.9. Thanks to Myron Marston for reporting the issue.
42
15f888e @bblimke The less hacky way to get the stream behaviour working for em-http-reque...
authored
43 ## 1.3.1
44
60fa244 @bblimke Updated changelog
authored
45 * The less hacky way to get the stream behaviour working for em-http-request. Thanks to Martyn Loughran
46
47 * Fixed issues where Net::HTTP was not accepting valid nil response body. Thanks to Muness Alrubaie
15f888e @bblimke The less hacky way to get the stream behaviour working for em-http-reque...
authored
48
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
49 ## 1.3.0
50
51 * Added support for [em-http-request](http://github.com/igrigorik/em-http-request)
52
53 * Matching query params using a hash
54
55 stub_http_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})
56
57 RestClient.get("http://www.example.com/?a[]=b&a[]=c") # ===> Success
58
59 request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made # ===> Success
60
61 * Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
26cb92f Small improvements to CHANGELOG for version 1.3.0
Bartosz Blimke authored
62
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
63 (Thanks to Steve Tooke for the idea and a solution for url-encoded bodies)
64
65 stub_http_request(:post, "www.example.com").
66 with(:body => {:data => {:a => '1', :b => 'five'}})
67
68 RestClient.post('www.example.com', "data[a]=1&data[b]=five",
69 :content_type => 'application/x-www-form-urlencoded') # ===> Success
70
71 RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
72 :content_type => 'application/json') # ===> Success
73
74 RestClient.post('www.example.com', '<data a="1" b="five" />',
75 :content_type => 'application/xml' ) # ===> Success
76
77 request(:post, "www.example.com").
78 with(:body => {:data => {:a => '1', :b => 'five'}},
79 :headers => 'Content-Type' => 'application/json').should have_been_made # ===> Success
80
81 * Request callbacks (Thanks to Myron Marston for all suggestions)
82
83 WebMock can now invoke callbacks for stubbed or real requests:
84
85 WebMock.after_request do |request_signature, response|
86 puts "Request #{request_signature} was made and #{response} was returned"
87 end
88
89 invoke callbacks for real requests only and except requests made with Patron client
90
91 WebMock.after_request(:except => [:patron], :real_requests_only => true) do |request_signature, response|
92 puts "Request #{request_signature} was made and #{response} was returned"
93 end
94
95 * `to_raise()` now accepts an exception instance or a string as argument in addition to an exception class
96
97 stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))
98
99 stub_request(:any, 'www.example.net').to_raise("some error")
100
26cb92f Small improvements to CHANGELOG for version 1.3.0
Bartosz Blimke authored
101 * Matching requests based on a URI is 30% faster
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
102
103 * Fixed constant namespace issues in HTTPClient adapter. Thanks to Nathaniel Bibler for submitting a patch.
104
fd2472a Version 1.2.2 changelog
Bartosz Blimke authored
105 ## 1.2.2
106
107 * Fixed problem where ArgumentError was raised if query params were made up of an array e.g. data[]=a&data[]=b. Thanks to Steve Tooke
108
5803f31 Version bump to 1.2.1
Bartosz Blimke authored
109 ## 1.2.1
110
111 * Changed license from GPL to MIT
112
113 * Fixed gemspec file. Thanks to Razic
114
31b3ffb Added version 1.2.0 changelog
Bartosz Blimke authored
115 ## 1.2.0
116
117 * RSpec 2 compatibility. Thanks to Sam Phillips!
118
119 * :allow_localhost => true' now permits 127.0.0.1 as well as 'localhost'. Thanks to Mack Earnhardt
120
121 * Request URI matching in now 2x faster!
122
123
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
124 ## 1.1.0
125
ee7b3b4 Fixed spelling
Bartosz Blimke authored
126 * [VCR](http://github.com/myronmarston/vcr/) compatibility. Many thanks to Myron Marston for all suggestions.
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
127
128 * Support for stubbing requests and returning responses with multiple headers with the same name. i.e multiple Accept headers.
129
130 stub_http_request(:get, 'www.example.com').
131 with(:headers => {'Accept' => ['image/png', 'image/jpeg']}).
132 to_return(:body => 'abc')
133 RestClient.get('www.example.com',
134 {"Accept" => ['image/png', 'image/jpeg']}) # ===> "abc\n"
135
136 * When real net connections are disabled and unstubbed request is made, WebMock throws WebMock::NetConnectNotAllowedError instead of assertion error or StandardError.
137
138 * Added WebMock.version()
139
140
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
141 ## 1.0.0
142
143 * Added support for [Patron](http://toland.github.com/patron/)
144
145 * Responses dynamically evaluated from block (idea and implementation by Tom Ward)
146
147 stub_request(:any, 'www.example.net').
148 to_return { |request| {:body => request.body} }
149
150 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
151
152 * Responses dynamically evaluated from lambda (idea and implementation by Tom Ward)
153
154 stub_request(:any, 'www.example.net').
155 to_return(lambda { |request| {:body => request.body} })
156
157 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
158
159 * Response with custom status message
160
161 stub_request(:any, "www.example.com").to_return(:status => [500, "Internal Server Error"])
162
163 req = Net::HTTP::Get.new("/")
164 Net::HTTP.start("www.example.com") { |http| http.request(req) }.message # ===> "Internal Server Error"
165
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
166 * Raising timeout errors (suggested by Jeffrey Jones) (compatibility with Ruby 1.8.6 by Mack Earnhardt)
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
167
168 stub_request(:any, 'www.example.net').to_timeout
169
170 RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout
171
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
172 * External requests can be disabled while allowing localhost (idea and implementation by Mack Earnhardt)
173
174 WebMock.disable_net_connect!(:allow_localhost => true)
175
176 Net::HTTP.get('www.something.com', '/') # ===> Failure
177
178 Net::HTTP.get('localhost:9887', '/') # ===> Allowed. Perhaps to Selenium?
179
180
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
181 ### Bug fixes
182
183 * Fixed issue where Net::HTTP adapter didn't work for requests with body responding to read (reported by Tekin Suleyman)
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
184 * Fixed issue where request stub with headers declared as nil was matching requests with non empty headers
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
185
b6c3b3b Version bump to 0.9.1
Bartosz Blimke authored
186 ## 0.9.1
187
188 * Fixed issue where response status code was not read from raw (curl -is) responses
189
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
190 ## 0.9.0
191
192 * Matching requests against provided block (by Sergio Gil)
193
194 stub_request(:post, "www.example.com").with { |request| request.body == "abc" }.to_return(:body => "def")
195 RestClient.post('www.example.com', 'abc') # ===> "def\n"
196 request(:post, "www.example.com").with { |req| req.body == "abc" }.should have_been_made
197 #or
198 assert_requested(:post, "www.example.com") { |req| req.body == "abc" }
199
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
200 * Matching request body against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
201
202 stub_request(:post, "www.example.com").with(:body => /^.*world$/).to_return(:body => "abc")
203 RestClient.post('www.example.com', 'hello world') # ===> "abc\n"
204
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
205 * Matching request headers against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
206
207 stub_request(:post, "www.example.com").with(:headers => {"Content-Type" => /image\/.+/}).to_return(:body => "abc")
208 RestClient.post('www.example.com', '', {'Content-Type' => 'image/png'}) # ===> "abc\n"
209
210 * Replaying raw responses recorded with `curl -is`
211
212 `curl -is www.example.com > /tmp/example_curl_-is_output.txt`
213 raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
214
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
215 from file
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
216
217 stub_request(:get, "www.example.com").to_return(raw_response_file)
218
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
219 or string
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
220
221 stub_request(:get, "www.example.com").to_return(raw_response_file.read)
222
223 * Multiple responses for repeated requests
224
225 stub_request(:get, "www.example.com").to_return({:body => "abc"}, {:body => "def"})
226 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
227 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
228
229 * Multiple responses using chained `to_return()` or `to_raise()` declarations
230
231 stub_request(:get, "www.example.com").
232 to_return({:body => "abc"}).then. #then() just is a syntactic sugar
233 to_return({:body => "def"}).then.
234 to_raise(MyException)
235 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
236 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
237 Net::HTTP.get('www.example.com', '/') # ===> MyException raised
238
239 * Specifying number of times given response should be returned
240
241 stub_request(:get, "www.example.com").
242 to_return({:body => "abc"}).times(2).then.
243 to_return({:body => "def"})
244
245 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
246 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
247 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
248
249 * Added support for `Net::HTTP::Post#body_stream`
250
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
251 This fixes compatibility with new versions of RestClient
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
252
253 * WebMock doesn't suppress default request headers added by http clients anymore.
254
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
255 i.e. Net::HTTP adds `'Accept'=>'*/*'` to all requests by default
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
256
257
258
259 ## 0.8.2
260
261 * Fixed issue where WebMock was not closing IO object passed as response body after reading it.
262 * Ruby 1.9.2 compat: Use `File#expand_path` for require path because "." is not be included in LOAD_PATH since Ruby 1.9.2
263
264
265 ## 0.8.1
266
267 * Fixed HTTPClient adapter compatibility with Ruby 1.8.6 (reported by Piotr Usewicz)
268 * Net:HTTP adapter now handles request body assigned as Net::HTTP::Post#body attribute (fixed by Mack Earnhardt)
269 * Fixed issue where requests were not matching stubs with Accept header set.(reported by Piotr Usewicz)
270 * Fixed compatibility with Ruby 1.9.1, 1.9.2 and JRuby 1.3.1 (reported by Diego E. “Flameeyes” Pettenò)
271 * Fixed issue with response body declared as IO object and multiple requests (reported by Niels Meersschaert)
272 * Fixed "undefined method `assertion_failure'" error (reported by Nick Plante)
273
274
275 ## 0.8.0
276
277 * Support for HTTPClient (sync and async requests)
278 * Support for dynamic responses. Response body and headers can be now declared as lambda.
279 (Thanks to Ivan Vega ( @ivanyv ) for suggesting this feature)
280 * Support for stubbing and expecting requests with empty body
281 * Executing non-stubbed request leads to failed expectation instead of error
282
283
284 ### Bug fixes
285
286 * Basic authentication now works correctly
287 * Fixed problem where WebMock didn't call a block with the response when block was provided
288 * Fixed problem where uris with single slash were not matching uris without path provided
289
290
291 ## 0.7.3
292
293 * Clarified documentation
294 * Fixed some issues with loading of Webmock classes
295 * Test::Unit and RSpec adapters have to be required separately
296
297
298 ## 0.7.2
299
300 * Added support for matching escaped and non escaped URLs
Something went wrong with that request. Please try again.