Skip to content

Commit

Permalink
Send query in the body instead of URL params
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassiano Leal committed Jul 17, 2017
1 parent 364776f commit 7330f5d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/puppetdb/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def request(endpoint, query, opts = {})

debug("#{path} #{json_query} #{opts}")

ret = self.class.get(path, query: filtered_opts)
ret = self.class.get(path, body: filtered_opts)
raise_if_error(ret)

total = ret.headers['X-Records']
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def expect_include_total(mock_query)
mock_response.expects(:parsed_response).returns([])

PuppetDB::Client.expects(:get).returns(mock_response).at_least_once.with do |_path, opts|
opts[:query] == { 'query' => '[1,2,3]' }
opts[:body] == { 'query' => '[1,2,3]' }
end
client.request('/foo', [1, 2, 3])
end
Expand All @@ -162,7 +162,7 @@ def expect_include_total(mock_query)

PuppetDB::Client.expects(:get).returns(mock_response).at_least_once.with do |_path, opts|
opts == {
query: {
body: {
'query' => '[1,2,3]',
'limit' => 10,
'counts-filter' => '[4,5,6]',
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def expect_include_total(mock_query)
mock_response.expects(:parsed_response).returns([])

PuppetDB::Client.expects(:get).returns(mock_response).at_least_once.with do |_path, opts|
opts[:query] == { 'query' => '[1,2,3]' }
opts[:body] == { 'query' => '[1,2,3]' }
end
client.request('/foo', [1, 2, 3])
end
Expand All @@ -162,7 +162,7 @@ def expect_include_total(mock_query)

PuppetDB::Client.expects(:get).returns(mock_response).at_least_once.with do |_path, opts|
opts == {
query: {
body: {
'query' => '[1,2,3]',
'limit' => 10,
'counts-filter' => '[4,5,6]',
Expand Down

0 comments on commit 7330f5d

Please sign in to comment.