webmock 1.24.3 → 1.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +7 -5
- data/Gemfile +0 -2
- data/README.md +4 -0
- data/gemfiles/ruby_1_8.gemfile +2 -2
- data/lib/webmock/util/query_mapper.rb +2 -1
- data/lib/webmock/version.rb +1 -1
- data/spec/unit/util/query_mapper_spec.rb +16 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 1.24.
|
4
|
-
|
5
|
-
* Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
|
6
|
-
|
7
|
-
Thanks to [Alex Kestner](https://github.com/akestner)
|
3
|
+
## 1.24.4
|
8
4
|
|
9
5
|
* Fixed the issue with parsing query to a hash with nested array i.e. `a[][b][]=one&a[][c][]=two`
|
10
6
|
|
11
7
|
Thanks to [Tim Diggins](https://github.com/timdiggins) for reporting the issue.
|
12
8
|
Thanks to [Cedric Pimenta](https://github.com/cedricpim) for finding the solution.
|
13
9
|
|
10
|
+
## 1.24.3
|
11
|
+
|
12
|
+
* Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
|
13
|
+
|
14
|
+
Thanks to [Alex Kestner](https://github.com/akestner)
|
15
|
+
|
14
16
|
* Added a clear message on an attept to match a multipart encoded request body.
|
15
17
|
WebMock does't support requests with multipart body... yet.
|
16
18
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/gemfiles/ruby_1_8.gemfile
CHANGED
@@ -4,6 +4,8 @@ source "http://rubygems.org/"
|
|
4
4
|
|
5
5
|
gem "addressable", ">= 2.3.6", "< 2.4.0"
|
6
6
|
|
7
|
+
gem "curb", "< 0.9.2"
|
8
|
+
|
7
9
|
group :development do
|
8
10
|
gem "rake", '~> 10.5.0'
|
9
11
|
end
|
@@ -17,5 +19,3 @@ platforms :jruby do
|
|
17
19
|
end
|
18
20
|
|
19
21
|
gemspec :path => "../"
|
20
|
-
|
21
|
-
gem 'curb', '< 0.9.2' unless RUBY_PLATFORM =~ /java/ #https://github.com/taf2/curb/issues/296
|
@@ -146,6 +146,7 @@ module WebMock::Util
|
|
146
146
|
last_container = current_node.select { |n| n.is_a?(Hash) }.last
|
147
147
|
if last_container && !last_container.has_key?(last_key)
|
148
148
|
if array_value
|
149
|
+
last_container[last_key] ||= []
|
149
150
|
last_container[last_key] << value
|
150
151
|
else
|
151
152
|
last_container[last_key] = value
|
@@ -159,7 +160,7 @@ module WebMock::Util
|
|
159
160
|
end
|
160
161
|
else
|
161
162
|
if array_value
|
162
|
-
current_node[last_key]
|
163
|
+
current_node[last_key] ||= []
|
163
164
|
current_node[last_key] << value
|
164
165
|
else
|
165
166
|
current_node[last_key] = value
|
data/lib/webmock/version.rb
CHANGED
@@ -48,6 +48,22 @@ describe WebMock::Util::QueryMapper do
|
|
48
48
|
expect(hsh['a'][0]['b'][0]['c'][0]['d'][0]).to eq('1')
|
49
49
|
expect(hsh['a'][0]['b'][0]['c'][0]['d'][1]['e']).to eq('2')
|
50
50
|
end
|
51
|
+
|
52
|
+
it "should parse nested repeated correctly" do
|
53
|
+
query = "a[][b][]=one&a[][b][]=two"
|
54
|
+
hsh = subject.query_to_values(query)
|
55
|
+
expect(hsh['a']).to be_a(Array)
|
56
|
+
expect(hsh['a'][0]).to eq({"b" => ['one']})
|
57
|
+
expect(hsh['a'][1]).to eq({"b" => ['two']})
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should parse nested non-repeated correctly" do
|
61
|
+
query = "a[][b][]=one&a[][c][]=two"
|
62
|
+
hsh = subject.query_to_values(query)
|
63
|
+
expect(hsh['a']).to be_a(Array)
|
64
|
+
expect(hsh['a'][0]['b']).to eq(['one'])
|
65
|
+
expect(hsh['a'][0]['c']).to eq(['two'])
|
66
|
+
end
|
51
67
|
end
|
52
68
|
|
53
69
|
context '#to_query' 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:
|
4
|
+
hash: 127
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 24
|
9
|
-
-
|
10
|
-
version: 1.24.
|
9
|
+
- 4
|
10
|
+
version: 1.24.4
|
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: 2016-04-
|
18
|
+
date: 2016-04-20 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|