webmock 1.12.2 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,5 +13,3 @@ matrix:
13
13
  - rvm: rbx-18mode
14
14
  - rvm: rbx-19mode
15
15
  - rvm: jruby-18mode
16
-
17
- script: "bundle exec rake && rake em_http_request_0_x_spec"
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.12.3
4
+
5
+ * Fixed issue with handling Addressable::URI with query params passed to `Net::HTTP.get_response`
6
+
7
+ Thanks to [Leif Bladt](https://github.com/leifbladt)
8
+
9
+ * Fixed HTTPClient adapter to not raise an error if a request with multipart body is executed.
10
+
3
11
  ## 1.12.2
4
12
 
5
13
  * Fixed issue with handling request.path when Addressable::URI is passed to #request instead of URI with Ruby 2.0.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- WebMock [![Build Status](https://secure.travis-ci.org/bblimke/webmock.png?branch=master)](http://travis-ci.org/bblimke/webmock) [![Dependency Status](https://gemnasium.com/bblimke/webmock.png)](http://gemnasium.com/bblimke/webmock)
1
+ WebMock [![Build Status](https://secure.travis-ci.org/bblimke/webmock.png?branch=master)](http://travis-ci.org/bblimke/webmock) [![Dependency Status](https://gemnasium.com/bblimke/webmock.png)](http://gemnasium.com/bblimke/webmock) [![Stories in Ready](http://badge.waffle.io/bblimke/webmock.png)](http://waffle.io/bblimke/webmock)
2
2
  =======
3
3
 
4
4
  Library for stubbing and setting expectations on HTTP requests in Ruby.
@@ -159,7 +159,7 @@ if defined?(::HTTPClient)
159
159
  signature = WebMock::RequestSignature.new(
160
160
  req.header.request_method.downcase.to_sym,
161
161
  uri.to_s,
162
- :body => req.content,
162
+ :body => req.http_body.dump,
163
163
  :headers => headers
164
164
  )
165
165
 
@@ -236,8 +236,8 @@ module WebMock
236
236
 
237
237
  path = request.path
238
238
 
239
- if path.respond_to?(:path) #https://github.com/bblimke/webmock/issues/288
240
- path = path.path
239
+ if path.respond_to?(:request_uri) #https://github.com/bblimke/webmock/issues/288
240
+ path = path.request_uri
241
241
  end
242
242
 
243
243
  path = WebMock::Util::URI.heuristic_parse(path).request_uri if path =~ /^http/
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '1.12.2' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.12.3' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -8,6 +8,7 @@ describe "HTTPClient" do
8
8
  include HTTPClientSpecHelper
9
9
 
10
10
  before(:each) do
11
+ WebMock.reset_callbacks
11
12
  HTTPClientSpecHelper.async_mode = false
12
13
  end
13
14
 
@@ -46,6 +47,32 @@ describe "HTTPClient" do
46
47
  str.should == 'test'
47
48
  end
48
49
 
50
+ context "multipart bodies" do
51
+ let(:header) {{
52
+ 'Accept' => 'application/json',
53
+ 'Content-Type' => 'multipart/form-data'
54
+ }}
55
+
56
+ let(:body) {[
57
+ {
58
+ 'Content-Type' => 'application/json',
59
+ 'Content-Disposition' => 'form-data',
60
+ :content => '{"foo": "bar", "baz": 2}'
61
+ }
62
+ ]}
63
+
64
+ let(:make_request) {HTTPClient.new.post("http://www.example.com", body: body, header: header)}
65
+
66
+ before do
67
+ stub_request(:post, "www.example.com")
68
+ end
69
+
70
+ it "should work with multipart bodies" do
71
+ make_request
72
+ end
73
+ end
74
+
75
+
49
76
  context "Filters" do
50
77
  class Filter
51
78
  def filter_request(request)
@@ -159,8 +159,8 @@ describe "Net:HTTP" do
159
159
  end
160
160
 
161
161
  it "should work with Addressable::URI passed to Net::HTTP.get_response" do
162
- stub_request(:get, 'http://www.example.com')
163
- Net::HTTP.get_response(Addressable::URI.parse('http://www.example.com/'))
162
+ stub_request(:get, 'http://www.example.com/hello?a=1').to_return(:body => "abc")
163
+ Net::HTTP.get_response(Addressable::URI.parse('http://www.example.com/hello?a=1')).body.should == "abc"
164
164
  end
165
165
 
166
166
  describe "connecting on Net::HTTP.start" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 12
9
- - 2
10
- version: 1.12.2
9
+ - 3
10
+ version: 1.12.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bartosz Blimke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-06-27 00:00:00 Z
18
+ date: 2013-06-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: addressable