mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Mappings that match on Json Body overwrite each other #631
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 @asos-alexhaigh on GitHub (Sep 16, 2024).
Originally assigned to: @StefH on GitHub.
Describe the bug
Using WireMock .Net TestContainers
When adding multiple mappings using
WithBodyWireMock does not seem to distinguish between the serialized content overwriting the previous mapping.These have the same path, but a different JSON body in the request.
For example I have a different "firstName" in my JSON object, but the second mapping overwrites the first so I get a "Mapping not found" error when both mappings are set up.
Expected behavior:
When a serialized object has different properties I would expect WireMock to be able to tell the difference between them so that different responses could be returned.
Test to reproduce
UserEndpointDataclassOther related info
Gist with setup
@StefH commented on GitHub (Sep 18, 2024):
@asos-alexhaigh
I think the issue here is that both mappings are using the same GUID (66cb85f5-6a2c-4f67-b685-3fcb9275e17a). If you want different mappings, use a unique GUID, or do not provide the GUID.