-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Loading mapping models with JsonMatcher
is not working correctly
#504
Comments
Hello @cezarypiatekGC . Thank you for your research. |
@cezarypiatekGC : can you try preview version from MyGet : |
Can you try new version |
Note that the So can you make a full example (unit test) which demonstrates your issue? |
Ok, I will try to prepare a test or demo app that reproduces that problem. |
Hello @RiccoFerraro, The 1.3.0 version does not have any preview fixed code for this issue, in order to test that you need MyGet version And can you create a full working example please? |
Hi @StefH Will do. I'll get back to you on if the issue is in that alpha build |
Hello @RiccoFerraro,did you have time yet to verify ? |
@StefH Sorry I haven't had a chance yet. I will try to take a look at this sometime this week. I'll post here when I've tried it. |
@StefH Sorry for the delay, still haven't had a chance to test this fix out yet. I've been absolutely slammed with work and will get to it as soon as I get a second. On a related note, I did notice something else about partial match scores that seemed off. (probably requires a little redesign). For our team to continue using wiremock.net we need to trust that the Http VERB is ALWAYS respected. I've been noticing that, even when a post call is fired, Get matches are being favored (given higher scores) over POST calls (in this case because of the bug mentioned above, the POST call has a lower score because it is failing to match on the body matcher). This seems off. It should match on the highest score, for only a single verb type. I can't imagine a scenario where someone is okay with a get request/response being returned for a post call in an integration test??? That would be a broken integration test to me. Can we introduce a flag to strictly enforce just the verb? |
@RiccoFerraro Thanks about your remark about the Http VERB. I did create a new Issue for this, and I'll take a look how to fix this. |
@RiccoFerraro Investigating + solving that Http Method issue will take some more time. Are you able to verify this issue ? |
Hi @StefH, thanks for being so responsive. I'm sorry I don't have time to create test projects and try the all the different versions this week. What I can do is pull down the version in #513 and see if the problems I was having with post body matching are fixed. After that seems to work, I'll work on setting "ParitalMapping" to false to enforce strict mapping. Question, is it in an official nuget.org version? I can't use my-get outside of POC's. |
Hello @RiccoFerraro , I'll release a new version with this fix tonight and for now close this issue. In case you have another problem please create a new issue. |
Hi @StefH Great stuff on that fix! it appears to work as expected! Quick question, What is the expected behavior for record playback for repeated calls to the same endpoint with these settings in 1.3.7? What I'm apparently experiencing is wiremock doesn't seem to actually proxy the second call to the same endpoint, and instead is serving it's recorded response. This is a problem, because the expected behavior of the endpoint in question is that it changes between calls and i need to capture both responses. I have verified this by calling the endpoint directly in postman (with and without the wiremock server base url) and I get different response. Maybe this can be solved by reseting the server mid test? |
@RiccoFerraro |
Describe the bug
Loading mapping models with
JsonMatcher
for Body matcher from a file is not working correctly.Steps to reproduce:
Expected behavior:
This is how
requestBuilder
looks like before saving mapping to a fileThis is how
requestBuilder
looks like after loading from a fileThe expectation is that the JsonMatcher works in the same way when loaded from a file and when created from the code. Currently, the pattern is always set to null when loading from a file.
Other notes
This is probably caused by this line where every pattern is cast to string (non-string values will result with a
null
)WireMock.Net/src/WireMock.Net/Serialization/MatcherMapper.cs
Line 39 in 7abf56e
The text was updated successfully, but these errors were encountered: