Skip to content
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

global Variable undefined #48

Closed
AnWeber opened this issue Jul 6, 2021 Discussed in #47 · 1 comment
Closed

global Variable undefined #48

AnWeber opened this issue Jul 6, 2021 Discussed in #47 · 1 comment
Labels
bug Something isn't working

Comments

@AnWeber
Copy link
Owner

AnWeber commented Jul 6, 2021

Discussed in #47

Originally posted by gerukin July 6, 2021
Hi, I'm new to httpyac. I currently use rest-client and Postman. The extension and runner look promising, congrats!, but somehow I cannot make anything work.

I'm using the latest general availability vscode (Mac) and have installed both the cli and the extension. I opened a new folder with just this one file:

@url = http://www.google.com

### Test
{{url}}

Clicking send gets me this:

ERROR: js: exports.$result = (url);
ERROR: ReferenceError - url is not defined
ReferenceError: url is not defined
	at Object.userJS (/Users/gerukin/dev/http-test/test.http:4:86)
	at Object.<anonymous> (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:37501)
	at Generator.next (<anonymous>)
	at /Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:36506
	at new Promise (<anonymous>)
	at s (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:36251)
	at Object.g (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:36785)
	at t.JavascriptVariableReplacer.<anonymous> (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:143455)
	at Generator.next (<anonymous>)
	at /Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:142841
	at new Promise (<anonymous>)
	at r (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:142586)
	at t.JavascriptVariableReplacer.replace (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:143089)
	at Object.<anonymous> (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:46841)
	at Generator.next (<anonymous>)
	at s (/Users/gerukin/.vscode/extensions/anweber.vscode-httpyac-2.18.0/dist/extension.js:587:46333)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)

This works though:

### Test
@url = http://www.google.com
{{url}}

But my understanding is that those variables are in a global scope and should be available to all requests. What am I doing wrong?

@AnWeber
Copy link
Owner Author

AnWeber commented Jul 6, 2021

The cause was an incorrect setting of an If condition for the check whether the progress bar should be displayed. This change was included in the previous version for httpbook and unfortunately caused an error in vscode-httpyac.

@AnWeber AnWeber added the bug Something isn't working label Jul 6, 2021
AnWeber added a commit to AnWeber/httpyac that referenced this issue Jul 6, 2021
@AnWeber AnWeber closed this as completed Jul 6, 2021
AnWeber added a commit that referenced this issue Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant