mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
BodyAsFile .json files interferes with WatchStaticMappings #127
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 @markdebruijne on GitHub (Aug 12, 2018).
ReadStaticMappings(myMappingsFolder)to import request matchers from static.jsonfilesWatchStaticMappings(myMappingsFolder)BodyAsFilemyResponseBodyFile.jsonResult: Unhandled exception occurs
It breaks because the
.jsonfile only contains the Body of the response, while the deserializer is expecting both aRequest: {}andResponse: {}elementThis feels like a bug because I want to have my request .json and responseBody .json stored close together on my file system. Is there another approach to store them differently which is compatible with the file watchers. I do want (during development) want to be able to watch both.
@StefH commented on GitHub (Aug 12, 2018):
The ReadStaticMappings and WatchStaticMappings are meant to be used for the complete mappings. A complete mapping contains both the request and the response. For an example, see https://github.com/WireMock-Net/WireMock.Net/wiki/Admin-API-Reference#__adminmappings-1.
If you want to use
BodyAsFile, you could just try to use a file with another extension, like.response. That kind of files will not be read or watched.Note that you probably need to set caching to false, (BodyAsFileIsCached = false) for that specific mapping.
@StefH commented on GitHub (Sep 11, 2018):
@markdebruijne does above text answer your question? Or do you still have more questions?
@StefH commented on GitHub (Oct 12, 2018):
@markdebruijne Closing this issue.
If you still have questions, comment here or create a new issue.