diff --git a/lib/pact_broker/client/cli/broker.rb b/lib/pact_broker/client/cli/broker.rb index 9c5790bd..f6ca80a1 100644 --- a/lib/pact_broker/client/cli/broker.rb +++ b/lib/pact_broker/client/cli/broker.rb @@ -109,14 +109,14 @@ def describe_version exit(1) unless result.success end - method_option :request, aliases: "-X", desc: "HTTP method", required: true + method_option :request, banner: "METHOD", aliases: "-X", desc: "HTTP method", required: true method_option :header, aliases: "-H", type: :array, desc: "Header" method_option :data, aliases: "-d", desc: "Data" method_option :user, aliases: "-u", desc: "Basic auth username and password eg. username:password" method_option :consumer, desc: "Consumer name" method_option :provider, desc: "Provider name" method_option :broker_base_url, required: true, aliases: "-b", desc: "The base URL of the Pact Broker" - method_option :broker_username, aliases: "-u", desc: "Pact Broker basic auth username" + method_option :broker_username, desc: "Pact Broker basic auth username" method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password" method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token" method_option :contract_content_changed, type: :boolean, desc: "Trigger this webhook when the pact content changes" diff --git a/lib/pact_broker/client/hal/link.rb b/lib/pact_broker/client/hal/link.rb index 29dc2322..960441ef 100644 --- a/lib/pact_broker/client/hal/link.rb +++ b/lib/pact_broker/client/hal/link.rb @@ -41,6 +41,10 @@ def get(payload = {}, headers = {}) wrap_response(href, @http_client.get(href, payload, headers)) end + def get!(*args) + get(*args).assert_success! + end + def put(payload = nil, headers = {}) wrap_response(href, @http_client.put(href, payload ? JSON.dump(payload) : nil, headers)) end diff --git a/lib/pact_broker/client/webhooks/create.rb b/lib/pact_broker/client/webhooks/create.rb index 654a6206..18d4a7d1 100644 --- a/lib/pact_broker/client/webhooks/create.rb +++ b/lib/pact_broker/client/webhooks/create.rb @@ -41,7 +41,7 @@ def create_webhook_with_consumer_and_provider end def create_webhook_with_optional_consumer_and_provider - webhook_entity = index_link.get._link("pb:webhooks").post(request_body_with_optional_consumer_and_provider) + webhook_entity = index_link.get!._link("pb:webhooks").post(request_body_with_optional_consumer_and_provider) if webhook_entity.response.status == 405 raise PactBroker::Client::Error.new(WEBHOOKS_WITH_OPTIONAL_PACTICICPANTS_NOT_SUPPORTED)