mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
WithBodyFromFile Support #45
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 @jrestall on GitHub (Oct 25, 2017).
Originally assigned to: @StefH on GitHub.
WireMock has support for reading the body content for a stubbed request from a file on disk.
http://wiremock.org/docs/stubbing/#specifying-the-response-body
This is very useful when body content can be very large.
I couldn't find a way to do this in WireMock.Net, I wonder if others would also like to see this support added?
@StefH commented on GitHub (Oct 25, 2017):
Sounds ok.
Method will be like:
@StefH commented on GitHub (Oct 25, 2017):
@jrestall I've added some code, can you maybe do a quick review before I create a new NuGet ?
Changed code found at
cbe6a0a2b4@jrestall commented on GitHub (Oct 25, 2017):
Thanks for the amazingly quick turn around @StefH.
I have three questions,
Can we also support relative paths where it defaults to a files directory as in WireMock. So passing path/to/myfile.xml could resolve to {some dir path}__admin/files/path/to/myfile.xml or similar?
Would the following JSON configuration work that uses a BodyAsFile property?
@StefH commented on GitHub (Oct 26, 2017):
1] This is possible I think.
2] JSONs could be:
OR
3] I'll take a look....
@StefH commented on GitHub (Oct 27, 2017):
3]
My idea is that you would cache small files or files which need to be served very fast.
Other files (big files) could increase the memory from a running WireMock too much, so for these files I would use the non-cached version.
@jrestall commented on GitHub (Oct 30, 2017):
Thanks @StefH, that makes sense. Again thank you so much for the quick turn-around on these enhancements.
@StefH commented on GitHub (Oct 30, 2017):
@jrestall ; the NuGet updated at https://www.nuget.org/packages/WireMock.Net/