Closed daniel-klingensmith-jamf closed 2 months ago
Hi @daniel-klingensmith-jamf, thanks for the suggestion.
It should be possible to achieve this using stores.
Note As an aside, bear in mind that any implementation is going to have to cater for concurrent requests, and any potential race conditions depending on your circumstances.
An approach using stores might look like this:
requestCount
/system/store
or optionally add a custom resource with a script that updates the value in the requestCount
store to zeroKeen to know you get on. Best of luck!
Yeah, stores with scripts seems like the solution I was looking for. Thank you!
Could we add a feature where if the same resource definition is hit X number of times we can reply with a separate response? I was thinking the mock resource definition would look something like the following:
With the above pattern we might continue to return the same response for all future requests after the first. If someone wanted the same response for the first 4 requests we might see:
To help migration, we could continue to support the single
response
schema. An endpoint to reset the counter for all resources or individual resources would be vital to help support this pattern as well.Let me know what you think @outofcoffee!