Skip to content

HTTPS clone URL

Subversion checkout URL

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