https://pact.io logo
#pact-jvm
Title
# pact-jvm
j

James P

04/13/2022, 4:44 PM
Hi, out of interest does the PactDslWithProvider
query
parameter url encode the variables it is sent? I have a service which sends a uri encoded value to another service
"from=2022-04-11T09%3A52%3A59%2B0100"
as a query parameter in the path. If I try and do a comparison using this value then it fails with an unexpected request error. However, if I wrap the query parameter in a uri decode statement then the request matches. When I send the http request, I just enter the value specified and thats enough to match. UPDATE: I've just found the
encodedQuery
param which has sorted out me having to encode the query, however the json I have generated does not have the encoded version
u

uglyog

04/13/2022, 10:43 PM
When you say generated JSON, do you mean in the Pact file?
j

James P

04/14/2022, 7:23 AM
Yes
The output is
Copy code
"query": {
          "from": [
            "2022-04-11T09:52:59+0100"
          ]
        }
Instead of
Copy code
"query": {
          "from": [
            "2022-04-11T09%3A52%3A59%2B0100"
          ]
        }
u

uglyog

04/18/2022, 3:39 AM
It will be stored unencoded in the Pact file. The reason is that most HTTP clients will encode the query parameters, so if it is stored encoded in the Pact file it will end up being double encoded when used
4 Views