bblimke/webmock — pull request #384 by insoul (2014-04-07 17:05:34+00:00)
Title: Fix query mapper

`WebMock::Util::QueryMapper` and `Rack::Utils` are different with nested parameters

```ruby
WebMock::Util::QueryMapper.values_to_query('one' => ['1','2'])
#=> "one[0]=1&one[1]=2"
WebMock::Util::QueryMapper.query_to_values('one[0]=1&one[1]=2')
#=> {"one"=>["1", "2"]}
WebMock::Util::QueryMapper.query_to_values('one[]=1&one[]=2')
#=> {"one"=>["1", "2"]} # same with 'one[0]=1&one[1]=2'
```

```ruby
Rack::Utils.build_nested_query('one' => ['1','2'])
#=> "one[]=1&one[]=2"
Rack::Utils.parse_nested_query('one[]=1&one[]=2')
#=> {"one"=>["1", "2"]}
Rack::Utils.parse_nested_query('one[0]=1&one[1]=2')
#=> {"one"=>{"0"=>"1", "1"=>"2"}}
```

I wonder what is correct mapping.

Anyway, when calling `Curl.get('http://example.com/test?one[]=1&one[]=2')`, WebMock shows tip.

```
You can stub this request with the following snippet:

stub_request(:get, "http://example.com/test?one%5B0%5D=1&one%5B1%5D=2").
to_return(:status => 200, :body => "", :headers => {})
```

After decoding url of tip above, query is converted to 'one[0]=1&one[1]=2'
This is confusing. So I fixed only this case.

```ruby
WebMock::Util::QueryMapper.values_to_query('one' => ['1','2'])
#=> "one%5B%5D=1&one%5B%5D=2"
```