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

Imports are not being reloaded before request execution #110

Closed
smaktacular opened this issue Mar 10, 2022 · 4 comments
Closed

Imports are not being reloaded before request execution #110

smaktacular opened this issue Mar 10, 2022 · 4 comments

Comments

@smaktacular
Copy link

smaktacular commented Mar 10, 2022

I'm using the import directive to separate my Personal Access Token (PAT) from my requests.
That means I have a file .pat.http with the following contents :

@Token = abcd ....

I then use the token in my requests, which is working fine, using:

# @import .pat.http

and

GET http://localhost/request
Authorization: Bearer {{Token}}

Whenever I regenerate the file containing the @token via Powershell script, the new contents of the file are not used until I reload VsCode (e.g. CTRL+SHIFT+P -> Developer: Reload WIndow)

I'm not 100% sure if this intended behavior or not. , but imho it'd be less error prone if the contents of the imported files would be reloaded on/before every request.

@AnWeber
Copy link
Owner

AnWeber commented Mar 10, 2022

I'm going to take a look at it. But it was more a conscious decision to not waste resources unnecessarily. I rely on vscode's update mechanism for changes to *.http files (notifies only on open files) and don't launch my own filesystem watcher. I will eventually reconsider though.
As a small workaround I could recommend to simply write the PAT to an .env file, which are located in the root of the project. .env data is always reloaded.

@AnWeber
Copy link
Owner

AnWeber commented Mar 10, 2022

It also works without FS Watcher. As long as the file is not opened, the file is reloaded. As soon as it is open within VSCode, the content is updated by VSCode events (AnWeber/httpyac@4f7bcab)

@AnWeber
Copy link
Owner

AnWeber commented Mar 10, 2022

I have now published the fix with v5.2.0.

@AnWeber AnWeber closed this as completed Mar 10, 2022
@AnWeber
Copy link
Owner

AnWeber commented Mar 16, 2022

I'm afraid I'll have to take fix back with the next version. The change causes quite a few problems and unfortunately must be solved more complicated. For this reason, when updating pat.http please just use the command httpyac.reset manually or my recommended workaround with `.env

AnWeber added a commit to AnWeber/httpyac that referenced this issue Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants