Skip to content

Commit

Permalink
fix: remove -u alias for --broker-username for create-webhook as it c…
Browse files Browse the repository at this point in the history
…lashes with the -u from the curl command

Fixes: #60
  • Loading branch information
bethesque committed Nov 25, 2019
1 parent 34d9d06 commit 9463eff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/pact_broker/client/cli/broker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions lib/pact_broker/client/hal/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/client/webhooks/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9463eff

Please sign in to comment.