You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .env files are searched from the following locations:
same location as *.http file
For the following files:
# spacex.http
GET {{HOST}}/launches/latest HTTP/1.1
# dev.env
HOST=https://api.spacexdata.com/v4
If I place these in the root of a git repo, then the following command works:
httpyac spacex.http --all -e dev
However, I move the files to a child of the root, for example, <repo>/test, running the command above from the test folder throws:
ReplaceVariableHook: javascript failed
BeforeRequestHook: requestVariableReplacer failed
{{HOST}}/launches/latest {
url: '{{HOST}}/launches/latest',
method: 'GET',
http2: false,
headers: {},
cookieJar: CookieJar {
rejectPublicSuffixes: true,
enableLooseMode: false,
allowSpecialUseDomain: false,
store: { idx: {} },
prefixSecurity: 'silent',
_cloneSync: [Function (anonymous)],
_importCookiesSync: [Function (anonymous)],
getCookiesSync: [Function (anonymous)],
getCookieStringSync: [Function (anonymous)],
getSetCookieStringsSync: [Function (anonymous)],
removeAllCookiesSync: [Function (anonymous)],
setCookieSync: [Function (anonymous)],
serializeSync: [Function (anonymous)]
},
proxy: undefined
} ReferenceError: HOST is not defined
at Object.<anonymous> (spacex.http:3:20)
at Me (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:18161)
at z (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:18526)
at Object.jo [as action] (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:2:43344)
at wt.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3409)
at async me (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:27307)
at async Object.Qr [as action] (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:55373)
at async be.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3392)
at async ie (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:14816)
at async $e.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3392)
ExecuteHook: httpClient failed
ReferenceError: HOST is not defined
at Object.<anonymous> (spacex.http:3:20)
at Me (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:18161)
at z (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:18526)
at Object.jo [as action] (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:2:43344)
at wt.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3409)
at async me (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:27307)
at async Object.Qr [as action] (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:55373)
at async be.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3392)
at async ie (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:14816)
at async $e.trigger (/home/stafford/.nvm/versions/node/v14.17.0/lib/node_modules/httpyac/dist/index.js:1:3392)
I think it's because this code is passing context.httpFile.rootDir, but I don't understand the relevance of rootDir at that position.
I also note that the vscode extension does not have this issue. The environment is selectable even under /test and the send suceeds.
The text was updated successfully, but these errors were encountered:
contect.httpFile.rootDir is undefined. Workaround would be to put a empty .httpyac.js next to the dev.env file. This code location differs between the VSCode extension and the CLI. VSCode always returns absolute File URIs, the CLI only relative ones. For this reason I use rootDir to generate an absolute URI again, but there I have a thinking error in it. I just noticed another constellation that would lead to a bug. Probably the easiest fix would be to convert the fileName in the CLI case to an absolute URI as well, but that needs to be looked at more closely.
Docs suggest that:
For the following files:
If I place these in the root of a git repo, then the following command works:
However, I move the files to a child of the root, for example,
<repo>/test
, running the command above from thetest
folder throws:I think it's because this code is passing
context.httpFile.rootDir
, but I don't understand the relevance ofrootDir
at that position.I also note that the vscode extension does not have this issue. The environment is selectable even under
/test
and the send suceeds.The text was updated successfully, but these errors were encountered: