pact-foundation / pact_broker-client

A Ruby and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
MIT License
69 stars 47 forks source link

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

Closed mefellows closed 3 months ago

mefellows commented 1 year ago

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.

davidjgoss commented 1 year ago

This also affects can-i-deploy (but not record-deployment). https://github.com/pact-foundation/pact_broker-client/issues/121

YOU54F commented 3 months ago

This is fixed in the above linked PR