webmock 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  #Changelog
2
2
 
3
+ ## 1.2.2
4
+
5
+ * 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
6
+
3
7
  ## 1.2.1
4
8
 
5
9
  * Changed license from GPL to MIT
data/README.md CHANGED
@@ -438,6 +438,7 @@ People who submitted patches and new features or suggested improvements. Many th
438
438
  * Sam Phillips
439
439
  * Jose Angel Cortinas
440
440
  * Razic
441
+ * Steve Tooke
441
442
 
442
443
  ## Background
443
444
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -16,7 +16,7 @@ module WebMock
16
16
  return uri if uri.is_a?(Regexp)
17
17
  uri = 'http://' + uri unless uri.match('^https?://') if uri.is_a?(String)
18
18
  normalized_uri = Addressable::URI.heuristic_parse(uri)
19
- normalized_uri.query_values = Hash[*normalized_uri.query_values.sort.flatten] if normalized_uri.query_values
19
+ normalized_uri.query_values = sort_query_values(normalized_uri.query_values) if normalized_uri.query_values
20
20
  normalized_uri = normalized_uri.normalize #normalize! is slower
21
21
  normalized_uri.port = normalized_uri.inferred_port unless normalized_uri.port
22
22
  normalized_uri
@@ -57,6 +57,10 @@ module WebMock
57
57
 
58
58
  private
59
59
 
60
+ def self.sort_query_values(query_values)
61
+ Hash[*query_values.sort.inject([]) { |values, pair| values + pair}]
62
+ end
63
+
60
64
  def self.uris_with_inferred_port_and_without(uris)
61
65
  uris.map { |uri| [ uri, uri.gsub(%r{(:80)|(:443)}, "").freeze ] }.flatten
62
66
  end
@@ -167,6 +167,11 @@ describe WebMock::Util::URI do
167
167
  end
168
168
  end
169
169
 
170
+ it "should successfully handle array parameters" do
171
+ uri = 'http://www.example.com:80/path?a[]=b&a[]=c'
172
+ lambda { WebMock::Util::URI.normalize_uri(uri) }.should_not raise_error(ArgumentError)
173
+ end
174
+
170
175
  end
171
176
 
172
177
  describe "stripping default port" do
data/webmock.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webmock}
8
- s.version = "1.2.1"
8
+ s.version = "1.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bartosz Blimke"]
12
- s.date = %q{2010-05-24}
12
+ s.date = %q{2010-05-26}
13
13
  s.description = %q{WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.}
14
14
  s.email = %q{bartosz.blimke@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 1
9
- version: 1.2.1
8
+ - 2
9
+ version: 1.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bartosz Blimke
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-24 00:00:00 +01:00
17
+ date: 2010-05-26 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency