Would match the files:
Foo1Bar2.data.json
FooBar2.data.json
Foo1Bar.json
Where '*' is a wildcard matching any value.
The wildcard would likely need to be some kind of token to avoid filename issues:
e.g. Foo_any_Barany
Another approach would be to make switch parameters optional. Effectively making any skipped parameter a wildcard.
The same request URL would match:
Bar2.data.json
Foo1.data.json
Looking at the code, this would require the setSwitchOptions function to return a collection of switch parameters and values. This would allow different (ordered) permutations of mock file loading to be tried.
Any thoughts? Would this be a major breaking change for some people?
If this sounds reasonable and I can find some time, I could put a PR together.
It would be great if there was a way to ignore values that are not important. One possibility would be to use some kind of wildcard.
e.g. config setup with: "switch": [ "Foo", "Bar" ], "mockFile": "data.json"
A request URL of: /example?Foo=1&Bar=2
Would match the files: Foo1Bar2.data.json FooBar2.data.json Foo1Bar.json
Where '*' is a wildcard matching any value. The wildcard would likely need to be some kind of token to avoid filename issues: e.g. Foo_any_Barany
Another approach would be to make switch parameters optional. Effectively making any skipped parameter a wildcard.
The same request URL would match: Bar2.data.json Foo1.data.json
Looking at the code, this would require the
setSwitchOptions
function to return a collection of switch parameters and values. This would allow different (ordered) permutations of mock file loading to be tried.Any thoughts? Would this be a major breaking change for some people? If this sounds reasonable and I can find some time, I could put a PR together.