You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems there is a problem with sending a wrong formatted JSON body on a GET request with a JSON body.
I am executing the next command: bundle exec pact-provider-verifier /hq-placements-client-hq-placements.json --provider hq-placements --provider-base-url 'http://localhost:3000/'
The body in the contract is this one:
"body": {
"sort_field": "not permitted value"
}
And I can see that the provider is receiving this body: "{\"sort_field\":\"not permitted value\"}"=>nil
But in case I use the query instead of body in the contract JSON file: "query": "sort_field=invalid", the request works properly.
Also, mention that I can do the same request using Postman or ‘curl’ and it works properly:
Did some debugging and I can see that when the query method is a GET (catching it with Wireshark), the body is translated into query params, but with what it seems with white spaces (what is formerly accepted, since the body on a GET request is not the ‘correct’ way to handle the request).
As fast as I change it to other methods, the body appears in the correct way.
So it parses the body into %7B%22sort_field%22%3A%22invalid%22%7D when it should be either a JSON body or a query parameter like sort_field=invalid
I am using a contract with this specification:
"pactSpecification": {
"version": "2.0.0"
}
For the gem: pact-provider-verifier (1.36.1)
The text was updated successfully, but these errors were encountered:
Seems there is a problem with sending a wrong formatted JSON body on a GET request with a JSON body.
I am executing the next command:
bundle exec pact-provider-verifier /hq-placements-client-hq-placements.json --provider hq-placements --provider-base-url 'http://localhost:3000/'
The body in the contract is this one:
And I can see that the provider is receiving this body:
"{\"sort_field\":\"not permitted value\"}"=>nil
But in case I use the
query
instead ofbody
in the contract JSON file:"query": "sort_field=invalid"
, the request works properly.Also, mention that I can do the same request using Postman or ‘curl’ and it works properly:
Did some debugging and I can see that when the query method is a GET (catching it with Wireshark), the body is translated into query params, but with what it seems with white spaces (what is formerly accepted, since the body on a GET request is not the ‘correct’ way to handle the request).
As fast as I change it to other methods, the body appears in the correct way.
So it parses the body into
%7B%22sort_field%22%3A%22invalid%22%7D
when it should be either a JSON body or a query parameter likesort_field=invalid
I am using a contract with this specification:
"pactSpecification": {
"version": "2.0.0"
}
For the gem: pact-provider-verifier (1.36.1)
The text was updated successfully, but these errors were encountered: