-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Bug [V4] PactDslJsonRootValue as request body fails #1841
Comments
Couple things are odd about that test. Firstly: However, this line Secondly: |
@rholshausen thanks for your answer. what would then be the correct Body saying "the pact allows any string, but as an example it should be 'exampleString'"? |
A regex matcher is the only one that makes sense for a plain text body. |
I tried .body(regexp(".*", "exampleString")) But this seems not to be allowed. Then I tried Is that what you were thinking of, or something else? |
Also when I use the same mechanism on the response side I get the error even with the stringMatcher version .willRespondWith { httpResponseBuilder ->
httpResponseBuilder
.status(201)
.header("Content-Type", TEXT_PLAIN_VALUE)
.body(PactDslJsonRootValue.stringMatcher(".*", "123456"))
} I get:
|
That's the correct way, but it looks like your provider is returning JSON encoded string as well. |
Or, on the response side, do you mean in your consumer test? |
Hi, sorry for the confusion. This is all a consumer test. first I had the problem when I had a string body as a request parameter, and that I could fix. But then I now have a string parameter in the response body and I could not use the same fix here for some reason |
My issue sounds a bit similar to #883, but this time it is with Pactversion V4.
I have the following pact test
When this runs, I get the pact error
when I change my request to be
"\"exampleString\""
it works (I run into the next issue in my pact, but this is out of scope here)So it seems there is an additional
"
expected for some reason?The text was updated successfully, but these errors were encountered: