Skip to content

Commit

Permalink
fix: removed undefined depth from query
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Nov 6, 2020
1 parent 147a810 commit 53a373d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact/consumer_contract/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def self.normalize_params(params, name, v)
else
params[k] ||= {}
raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k])
params[k] = normalize_params(params[k], after, v, depth - 1)
params[k] = normalize_params(params[k], after, v)
end

params
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/pact/consumer_contract/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ module Pact
it "returns a nested map" do
expect(subject).to eq "foo" => "bar2", "baz" => ["thing1", "thing2"]
end

it "handles arrays and hashes" do
expect(Query.parse_string("a[]=1&a[]=2&b[c]=3")).to eq "a" => ["1","2"], "b" => { "c" => "3" }
end
end
end
end
Expand Down

0 comments on commit 53a373d

Please sign in to comment.