-
-
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
Can I preserve Mapping title and matchers for proxy response? #819
Comments
I would expect that all matches would be used to find the correct/best match. So what would be you proposal? Create a mapping-file-title also based on the body matcher? |
I'm surprised that the Path and Regex matcher aren't used for the saved mapping. I expect some immaterial changes in the request body, such as timestamps, so I wouldn't want an exact match on the request body saved in the mapping. But that seems to be what is happening. For the title, I'd also expect it to be used for the mapping file as it was provided in the Given/RespondWith setup. When I use version 1.3.10, the supplied title was used, but the response saved in the mapping was just the proxy url. In the current version, the Request and Response for the mapping look like they're recreated in the proxy helper instead of using what's stated in the Given/RespondWith methods. |
Just to clarify how it's currently implemented -> None of the matchers defined in your The |
That matches with what I've seen. Because I'd like to reuse the mappings as stubs after they've been saved to a file, it would be nice if the matchers defined in the |
A possible solution could be to:
|
That sounds like it would work to me. I've started working on a change that seems similar, but uses more of the mapping in the chance that more than the matchers might be wanted. I created a PR so you can see what I meant. |
See preview: |
I tested with I was able to verify the recorded mappings are saved with the title from the request mapping, and that the request matchers are storing the matchers from the |
A new official nuget version will be released in some days. |
Thanks @StefH I appreciate all of your help! |
Hello again @StefH |
Later today. |
Done. |
Hello.
I use a third party SOAP service that I've been told I run tests against too often. I was hoping to use WireMock to proxy and record these requests. Then I'd like to use the recorded mappings as stubs going forward. To proxy and record the initial set, I use something like this:
Because it is a SOAP service, all the requests use the same URL. The request primarily differ on the body contents. Currently when I run these requests, it seems like a new mapping is creating, using the path and method to create a new title. Since the path and method are the same for each request, each request overwrites the one before it. It also seems that the regex matchers that were specified in the original mapping are being discarded in favor of matching the url, path, headers, and an exact match on the body of the request.
If that understanding is correct, is there a way to work around this behavior to preserve the original mapping? If there isn't a work around, I'd like to submit a PR. In it, I'd try to add an option to ProxyAndRecordSettings and use that to decide how to build the resulting mapping. Would that help?
The text was updated successfully, but these errors were encountered: