pact-foundation/pact_broker-client

Strip trailing `/` from broker base URL for publish-provider-contract command

Opened this issue · 1 comments

If the broker base URL contains a trailing slash (/), the / is added to all relative URL fetches, resulting in 404.

e.g. given the following:

docker run --rm \
  -w ${PWD} \
  -v ${PWD}:${PWD} \
  -e PACT_BROKER_BASE_URL=https://foo.pactflow.io/ \
  -e PACT_BROKER_TOKEN=$PACT_BROKER_TOKEN \
  pactfoundation/pact-cli:latest \
  pactflow publish-provider-contract \
  oas/openapi.yaml \
  --provider my-provider \
  --provider-app-version 1.0.0 \
  --branch my-branch \
  --content-type application/json \
  --verification-exit-code=0 \
  --verification-results result/report.md \
  --verification-results-content-type application/yaml \
  --verifier "github-actions"

The following error is shown:

Error making request to https://foo.pactflow.io//contracts/provider/some-provider-app/version/1.0.0 status=404 {"error":"The requested document was not found on this server."}

This problem is not present for the regular publish pact command.

This also affects can-i-deploy (but not record-deployment). #121