Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect URL decoding in PactBrokerClient when fetching pacts #1154

Closed
mszczygiel opened this issue Jul 2, 2020 · 2 comments
Closed

Incorrect URL decoding in PactBrokerClient when fetching pacts #1154

mszczygiel opened this issue Jul 2, 2020 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@mszczygiel
Copy link

Hello,
While versioning contracts, we append git branch name to the version so we always have separate contract per branch. Unfortunately, when version contains special characters (like '/' in my case) fetching pacts via PactBrokerClient.fetchLatestConsumersWithNoTag or PactBrokerClient.fetchConsumersWithSelectors fails with au.com.dius.pact.core.pactbroker.NotFoundHalResponse: No HAL document found at path .... For example for response from the broker containing:

{
"href": "http://broker-url/pacts/provider/provider.name/consumer/consumer.name/version/3.0.2-SNAPSHOT-feature%2F123",
"title": "title",
"name": "consumer.name"
}

PactBrokerClient would go to
http://broker-url/pacts/provider/provider.name/consumer/consumer.name/version/3.0.2-SNAPSHOT-feature/123 which is incorrect in this case.
Pact jvm version that we're using is 4.0.10, but I can see nothing has changed in this area on current master.

It seems that href decoding is unnecessary, if you agree (or have other suggestion on how to approach it) then I'm happy to contribute a fix for that.

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Jul 12, 2020
@uglyog
Copy link
Member

uglyog commented Jul 12, 2020

The problem is that if we don't decode the URL, when the HTTP client encodes it before sending the request, and it will end up double encoded.

@uglyog
Copy link
Member

uglyog commented Aug 9, 2020

4.1.7 has been released with this fix

@uglyog uglyog closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants