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