-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Question: WithBody can't be used with multiple matching rules? #303
Comments
Good point. "Body": {
"Matchers": [
{
"Name": "JsonMatcher",
"Pattern": "{ \"x\": 42, \"s\": \"text\" }"
},
{
"Name": "JsonMatcher",
"Pattern": "{ \"x\": 42, \"s\": \"stef\" }"
}
]
} I'll have to check the code... |
I've updated the code, can you take a look at the latest version at MyGet? |
@StefH Sorry for late notice. Yeah, will do tomorrow. I'm off for now. Thank you for such a quick response though! |
Hi @StefH Nah, couldn't wait till tmr. At a first glance I was able to get it working. I succeeded in building a valid mocking template with array of BodyMatchers:
(pay no attention to jsons. I changed them as I could). But then I noticed such behaviour. Let's assume I have two body matchers and all of them are for instance JsonMatchers. One of it is totally correct (worked without array introduction) and the second one is some rubbish (as in json from above). Then after making a request I see it passed even with one 'negative' result of matching as I think. Is it expected or not? Does work like - if at least one matcher succeeded then return given response? |
Currently the logic is for all (~almost all) matchers is that the matchers are used as an If required in future, I can also implement an |
Got it, thanks. For now I don't see any reason for doing it. Anyway, I'm happy with this change. Do you have eta when it will be available in stable? |
In some hours. |
Stuck with a question: is it possible to use several matching rules for request body?
WithParam(...) from IParamsRequestBuilder as well as WithHeader(...) from IHeadersAndCookiesRequestBuilder support smth like:
since it intakes key.
But for WithBody(...) from IRequestBuilder can't do smth similar.
How can I deal with several matching rules for request body?
The text was updated successfully, but these errors were encountered: