Skip to content

Commit

Permalink
feat: changed behaviour from @ref (AnWeber/vscode-httpyac#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber committed Oct 30, 2024
1 parent 1274d8e commit 7339667
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## [6.16.3] (2024-10-30)

### Fix
- revert: named response is only set, if all testResults are valid
- changed behaviour from `@ref` (AnWeber/vscode-httpyac#336)
- negative test results from reference does not stop dependent request
- errored reference is not executed multiple times if it is referenced multiple times


## [6.16.2] (2024-10-29)

### Fix
- named response is only set, if all testResults are valid


## [6.16.1] ( 2024-10-29)

### Fix
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"publisher": "AnWeber",
"description": "HTTP/REST CLI Client for *.http files",
"version": "6.16.1",
"version": "6.16.3",
"homepage": "https://github.com/AnWeber/httpyac",
"repository": {
"type": "git",
Expand Down
10 changes: 4 additions & 6 deletions src/plugins/core/metaData/refMetaDataHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ class RefMetaAction {
const envKey = utils.toEnvironmentKey(context.activeEnvironment);
utils.setVariableInContext(reference.variablesPerEnv[envKey], context);
log.trace('import variables', reference.variablesPerEnv[envKey]);
if (this.data.force || utils.isUndefined(context.variables[name])) {

const isNotExecuted =
utils.isUndefined(context.variables[name]) && !context.processedHttpRegions?.some(p => p.id === reference.id);
if (this.data.force || isNotExecuted) {
result = await reference.execute(context);
if (result) {
// ref to ref variable export
utils.setVariableInContext(reference.variablesPerEnv[envKey], context);
} else if (
reference.testResults &&
reference.testResults.some(t => t.status !== models.TestResultStatus.SUCCESS)
) {
utils.addSkippedTestResult(context.httpRegion);
}
}
} else {
Expand Down
5 changes: 1 addition & 4 deletions src/store/httpRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ export class HttpRegion implements models.HttpRegion {
if (!this.isGlobal()) {
this.resetDependentRegionsWithVisitor(toEnvironmentKey(context.activeEnvironment), this, []);
}
const isNotCanceled = result !== HookCancel && result.every(obj => !!obj);
const hasOnlySucessTestResults =
!this.testResults.length || this.testResults.every(t => t.status === models.TestResultStatus.SUCCESS);
return isNotCanceled && hasOnlySucessTestResults;
return result !== HookCancel && result.every(obj => !!obj);
} catch (err) {
if (isError(err)) {
if (!err.handled) {
Expand Down

0 comments on commit 7339667

Please sign in to comment.