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

query string encoding when verifying contracts with pact-jvm #97

Closed
nagliyvred opened this issue Mar 6, 2015 · 3 comments
Closed

query string encoding when verifying contracts with pact-jvm #97

nagliyvred opened this issue Mar 6, 2015 · 3 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@nagliyvred
Copy link

Link to a corresponding google thread

Hi guys,

We are using a ruby-based pact-mock-service on the consumer side to generate a pact file and verifying the contract by using pact-jvm (more specifically the gradle plugin). One of our resources accepts a bunch of query parameters, and the generated contract looks like this:

"request": {
  "method": "get",
  "path": "/autoComplete/address",
  "query": "max_results=100&state=NSW&term=80+CLARENCE+ST,+SYDNEY+NSW+2000",
}

As you can see the query is encoded on the ruby side, however, apparently the java side expects a decoded value there and we receive "80+CLARENCE+..." in our controller.

Thanks,
Evgeny

@uglyog
Copy link
Member

uglyog commented Mar 31, 2015

I'm thinking of pushing for a change in the pact spec to store the query parameters as a map of arrays. That way they will always be stored unencoded, and it will resolve this issue.

As a work around, I'm going to unencode the query string after loading it from the pact file. The side effect of this is that any query parameter that contains a '+' will be replaced with a space. However, '+' should be used in paths, and %20 in query parameters.

@bethesque
Copy link
Member

The Ruby impl already talks between the test and the mock server using a map of arrays, it would be very simple to change that to serialise it to the pact that way. I think it's a good idea.

@uglyog uglyog added bug Indicates an unexpected problem or unintended behavior V3 labels Aug 20, 2015
@uglyog
Copy link
Member

uglyog commented Oct 6, 2015

Version 3.1.0 allows V3 format pact files which should resolve this issue.

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

3 participants