-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: enable major features of the after-response script #7411
Conversation
6743837
to
86f1a26
Compare
6e12103
to
f7e30f0
Compare
…#7329) * feat: integrate post-request script to the engine * refactor: some minor improvements * fix: lint error * chore: clean up typings * refactor: separate transforming into sync and async parts * use named args * fix: renaming pre-req vars, functions and 2 minor fixes * fix: the error message is updated * feat: add snippets for post-request scripting (#7395) * feat: enable extended assertion chains on `insomnia.response` (#7396) * feat: add snippets for post-request scripting * feat(sdk): support response.to.have assertion for verifying response * chore: fix lint error --------- Co-authored-by: jackkav <jackkav@gmail.com>
* feat: support importing post-req script from Postman * fix: introduce post-req script property for merged changes * test: add a test case for importing scripts * fix: add missing fixture * chore: remove row after merging
0b6803a
to
8c76934
Compare
Looks like this base env logic will have to change. Since throwing the error will break most of the tests. What could be added to the docs? I still feel like baseEnv should not be a concept that scripts should be aware of. |
// when base environment is activated, `mutatedContext.environment` points to it | ||
const isActiveEnvironmentBase = mutatedContext.environment?._id === baseEnvironment._id; | ||
const hasEnvironmentAndIsNotBase = mutatedContext.environment && !isActiveEnvironmentBase; | ||
if (hasEnvironmentAndIsNotBase) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently we don't need to persist changes outside of the scripts, see INS-3852
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the baseEnvironment handler is mainly for providing a way to manipulate base environment then composition of environments will work, anyway let's discuss.
* feat: update data model and request-pane to support post-req-script * fix: unit test failed * feat: integrate post-request script to the engine - INS-3785,INS-3786 (Kong#7329) * feat: integrate post-request script to the engine * refactor: some minor improvements * fix: lint error * chore: clean up typings * refactor: separate transforming into sync and async parts * use named args * fix: renaming pre-req vars, functions and 2 minor fixes * fix: the error message is updated * feat: add snippets for post-request scripting (Kong#7395) * feat: enable extended assertion chains on `insomnia.response` (Kong#7396) * feat: add snippets for post-request scripting * feat(sdk): support response.to.have assertion for verifying response * chore: fix lint error --------- Co-authored-by: jackkav <jackkav@gmail.com> * test: add tests for post-request scripts and post-request scripts - INS-3786 (Kong#7331) * test: add some tests for post-req script and script engine * fix: incorrect script type * chore: refresh package-lock after merging * chore: clean up package-lock.json * fix: failed tests after rebasing * feat: support importing post-req script from Postman (Kong#7423) * feat: support importing post-req script from Postman * fix: introduce post-req script property for merged changes * test: add a test case for importing scripts * fix: add missing fixture * chore: remove row after merging * chore: rename to after-response-script * fix test * refresh lock * update snapshot * extract pre request logic to function * refresh lock again * throw on base env * fix: revert the logic which rejects the case of unselected environment --------- Co-authored-by: jackkav <jackkav@gmail.com>
Ref: INS-3699
Changes
This is the feature branch of the post-request script which contains following changes:
insomnia.response
#7396questions