mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
WM is matching during proxy (recording) mode - why? #412
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PrzemekScott on GitHub (Mar 29, 2022).
Hey @StefH we have some issue with a working flow for WM. As you may remember from my previous messages, we want to use WM in proxy mode for recording only, so then we could run our tests against that mappings created when the WM is run only in matching mode.
But what we experienced is that when we are trying to prepare mappings, WM running on proxy mode, the WM is also doing matching with mappings which were created a moment ago. So basically this blocks us totally from recording proper mappings, and with continuing of our testing with the use of WM.
So can you please specify if there is any setting that we need to put a flag on which will block the matching when WM is run in proxy mode, so it will only record mappings.
If there is no such a setting. Can you please develop it and add, cause it would make the WM more dynamic for different usage scenarios. Thx
@PrzemekScott commented on GitHub (Mar 30, 2022):
I think, our needs are partially similar to this previous question https://github.com/WireMock-Net/WireMock.Net/issues/632
@StefH commented on GitHub (Mar 30, 2022):
I understand your question.
I'll try to investigate the issue.
But please keep in mind that I'm also working on other issues and other projects.
@PrzemekScott commented on GitHub (Mar 30, 2022):
Sure! Thanks for giving the sign :)
@StefH commented on GitHub (Apr 3, 2022):
@PrzemekScott
About this specific question, I tested this code:
And when I do a call to WireMock.Net (using postman to post a body), everytime the proxied endpoint (http://postman-echo.com/post) is hit.
The internal saved mapping is not used it seems?
Can you tell me your setup ?
Or provide an example program?
@PrzemekScott commented on GitHub (Apr 3, 2022):
@StefH
This is how the settings looks like:
And this is how we handel WireMock as a web app:
I will ask my team mate, Jatin, to comment here, cause he was specifically doing this experiment/testing when he noticed 'matching' happening when proxy settings were ON too. @jatin-prusty-travelport
@jatin-prusty-travelport commented on GitHub (Apr 4, 2022):
@StefH I believe everytime you make a request to http://postman-echo.com/post, some header (like requestId or some other token) always changes and hence you are able to capture all the mappings. This can be verified by checking the generated mappings. But if you blacklist those headers then you can see that it first tries to serve the response from the captured mappings, and it goes to the proxy URL only if a matching mapping is not found.
@StefH commented on GitHub (Apr 4, 2022):
Can you try preview version
1.4.40-ci-16009?@jatin-prusty-travelport commented on GitHub (Apr 5, 2022):
Thanks @StefH! I have checked the preview version and it works exactly as we wanted. So in proxy mode it is not serving from the mapping.
But For wiremock to be more dynamic, I would really like to have a appsetting to define whether we want to enable this feature or not. In some cases people might want it to switch to mock mode when a mapping is captured.
Will leave it upto you to decide. Can you please let us know when you can (update if required and) release this code?
@StefH commented on GitHub (Apr 6, 2022):
@jatin-prusty-travelport
I think I get your last question...
My current solution is to make sure that the priority is used --> the priority from the Proxy mapping is defined in such a way that this get preference over the just created mapping.
I need to think on a good way to change the code to make it switch to mock mode when a mapping is captured...
@StefH commented on GitHub (Apr 21, 2022):
Closing this...