Dynamic Body not to be cached when a Func is used to created the body
See original GitHub issueI’m using wirenet.net as a standalone process. The response func code below loads an existing file from disk, mutates the string and return it to the user. In my case it mutates all the dates relative to the todays date.
Because it a dynamics response I don’t want the response to be cached. Currently (version 1.5.6), I think, the behaviour is caching the response every time its invoked increasing the memory on each request.
server.Given(Request.Create()
.WithPath($"/someurl/")
.UsingPost())
.RespondWith(Response.Create()
.WithBody(req =>
{
var xml = File.ReadAllText($"./myxmlfile.xml");
xml = MutateString(xml);
return xml;
})
.WithStatusCode(200)
.WithHeader("Content-Type", "application/xml"));
Issue Analytics
- State:
- Created a year ago
- Comments:12
Top Results From Across the Web
Forcing a dynamically loaded javascript to not cache on ...
To this end I have created an external javascript file in which I put the data I want to use. I load the...
Read more >Server-side caching - Apollo GraphQL Docs
Use @cacheControl for fields that should usually be cached with the same settings. If caching settings might change at runtime, you can use...
Read more >How to Deal With Caching And Dynamic Content
To make your app cacheable and CDN-ready you have to avoid session-specific content in the cached content rendered on the server. You have...
Read more >What Is Cache-Control? Everything You Need to Know
Cache -control is an important way by which developers can dictate how resources will be cached when a user browses the internet. Without...
Read more >Data Fetching, Caching, and Revalidating
Fetching data on the Server with third-party libraries If the segment is dynamic, the output of the request will not be cached and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

A log entry defines the request AND the response.
So the memory will increase, but not as much as before (in case you had big xml-strings to return).
If you do not want log entries at all, you can set the
MaxRequestLogCountto0in the settings.Yes I can understand that the memory is increased because the return value from that Func is a string, and this is saved internally.
However I think that this is only kept in memory for logging the request. So cleaning the logging could help, or I can investigate if in case it’s a Func, the response is not saved to the logging.