Skip to content

Commit 6560033

Browse files
committed
[API] Adds required body argument to connector.post
1 parent f1fcfbf commit 6560033

File tree

2 files changed

+5
-3
lines changed
  • elasticsearch-api
    • lib/elasticsearch/api/actions/connector
    • spec/elasticsearch/api/actions/connector

2 files changed

+5
-3
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/connector/post.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ module Actions
2929
# support SLA of official GA features.
3030
#
3131
# @option arguments [Hash] :headers Custom HTTP headers
32-
# @option arguments [Hash] :body The connector configuration.
32+
# @option arguments [Hash] :body The connector configuration. (*Required*)
3333
#
3434
# @see https://www.elastic.co/guide/en/enterprise-search/8.12/connectors.html
3535
#
3636
def post(arguments = {})
3737
request_opts = { endpoint: arguments[:endpoint] || "connector.post" }
3838

39+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
40+
3941
arguments = arguments.clone
4042
headers = arguments.delete(:headers) || {}
4143

elasticsearch-api/spec/elasticsearch/api/actions/connector/post_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
'POST',
2424
'_connector',
2525
{},
26-
nil,
26+
{},
2727
{},
2828
{ endpoint: 'connector.post' }
2929
]
3030
end
3131

3232
it 'performs the request' do
33-
expect(client_double.connector.post(connector_id: 'foo')).to be_a Elasticsearch::API::Response
33+
expect(client_double.connector.post(connector_id: 'foo', body: {})).to be_a Elasticsearch::API::Response
3434
end
3535
end

0 commit comments

Comments
 (0)