let 'main' be a function that passes in Index #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I was looking for a module just like this one, so was glad to find it :)
In my use case, I wanted each request to have different random information in the payload, or a random header. I assumed I could pass bench-rest a function, and it would call the function each time a request is generated so that I can easily calculate different parameters each time.
Here's an example of sending different coordinates to an api endpoint that tracks the location of a package:
Notice how interpolation of the INDEX is no longer necessary, if we just have the flow defined as a function instead of a plain json object. The index can be passed in as the first argument and used by users if they choose.
Of course, the change is backwards compatible, if you pass in a plain object, it uses it. If you pass in a function it runs the function to get the object.
My implementation in this PR is a first draft. If you like the idea I can flesh-out the support and add docs.
What do you think?