Comments (7)
@jrestall ; the NuGet updated at https://www.nuget.org/packages/WireMock.Net/
from wiremock.net.
Sounds ok.
Method will be like:
IResponseBuilder WithBodyFromFile([NotNull] string filename, bool cache =true);
from wiremock.net.
@jrestall I've added some code, can you maybe do a quick review before I create a new NuGet ?
Changed code found at cbe6a0a
from wiremock.net.
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?
{
"Guid": "791a3f31-6946-4ce7-8e6f-0237c7443275",
...
"Response": {
"StatusCode": 404,
"BodyAsFile ": "path/to/myfile.xml"
}
}
- A FileWatcher might be easier to use than having to specify whether each file is cached or not. Cache by default and clear the cache if a file is changed?
from wiremock.net.
1] This is possible I think.
2] JSONs could be:
{
"Guid": "5c5b769a-7cfe-44bd-9801-a4e5fcf9bfc5",
"Priority": 0,
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/file"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"StatusCode": 200,
"BodyAsFile": "c:\\temp\\x.json",
"BodyAsFileIsCached": false,
"UseTransformer": false,
"Headers": {}
}
}
OR
{
"Guid": "55631924-791a-419e-928f-b735e312ab99",
"Priority": 0,
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/filecache"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"StatusCode": 200,
"BodyAsBytes": "ew0KICAiaGkiOiAidGVzdCINCn0=",
"BodyAsFileIsCached": true,
"UseTransformer": false,
"Headers": {}
}
}
3] I'll take a look....
from wiremock.net.
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.
from wiremock.net.
Thanks @StefH, that makes sense. Again thank you so much for the quick turn-around on these enhancements.
from wiremock.net.
Related Issues (20)
- Master branch doesn't build HOT 1
- C# Unit test: Wiremock Server runs but does not deliver response HOT 2
- Docs: Documentation is misleading/incomplete for BodyAsFile HOT 1
- Response Templating complex objects HOT 11
- Connection prematurely closed BEFORE response HOT 3
- Request Matching JsonPathMatcher Partially
- WireMock.Net.Client Request Builder Matchers HOT 8
- AbstractJsonPartialMatcher: Regex Value is Uppercased when IgnoreCase is set to true HOT 2
- Generating mappings from Payroc open-api file gives ArgumentException: Property with the same name already exists on object HOT 10
- Error in RequestMessageMultiPartMatcher HOT 3
- WireMock.Org.RestClient vs WireMock.Net.RestClient? HOT 1
- XML transformation HOT 7
- Request matching WithProbability strange behaviour
- How do I access admin endpoints if WireMock.Net is hosted behind AWS application load balancer? HOT 11
- Allow WithMappings to support scanning SubDirectories when building a WireMockContainer HOT 4
- WireMock.Org nullable properties and defaults HOT 4
- FormEncoded Request fails (404 Not Found) if key value pairs order in mapping is different from request body order HOT 19
- Using google.protobuf.Empty as response results in a bad gRPC response HOT 3
- Response is auto converting string to guid HOT 2
- Bump Request CS-Script 4.8.13 to 4.8.17 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiremock.net.