-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize redundant mock scripts evaluation #103
Comments
Hello @w-ess , could you provide more details? how are you noticing the duplication? I've just sent an e-mail so we can work on your case |
Hi, example sent by e-mail |
The behavior described in this issue is actually by design and is caused by multiple template transformations occurring along the mocking pipeline, leading to re-evaluation of script snippets. For instance, given the mock in the provided screenshot, the script
Given that the condition is dynamic, the mock must not be returned when it is evaluated to false. This is step could be optimized to partially evaluate the template, looking only for the condition field
This stage leads to re-evaluation of mock scripts, this time with all context variables available (like route variables). There is also a third possible moment where the script might be evaluated again, when using the callback template:
@w-ess I'll change the title of the issue and consider this optimization as an improvement instead of an actual bug. |
Prerequisites
Description
Redundant script evaluation
Steps to reproduce
Given a mock with a single custom script in the body. Calling its respective method, the script will be evaluated twice.
Expected behavior
The script should be evaluated once.
Screenshots
Additional context
No response
The text was updated successfully, but these errors were encountered: