Closed dlucazeau closed 1 year ago
I am just trying to understand the structure. I put this example together, I noticed that httpbook does not currently populate the history. Therefore I use vscode-httpyac for my gif. But according to the output it seems to work in httpbook.
login.http
# @name login GET https://httpbin.org/anything?id={{$guid}} HTTP/1.1
POST https://httpbin.org/anything HTTP/1.1 {{login.args.id}}
POST https://httpbin.org/anything HTTP/1.1 {{login.args.id}}
> request.http
POST https://httpbin.org/anything HTTP/1.1 {{accessToken.data}}
POST https://httpbin.org/anything HTTP/1.1 {{accessToken.data}}
POST https://httpbin.org/anything HTTP/1.1 {{accessToken.data}}
- Request `Always Execute all Requests` always calls accessToken which `@forceRef`/ calls login. I get always a new guid => seems correct
- Request ` Only Call AccessToken but no new Login Request` always calls accessToken which only `@ref` login. Login is only called on first request => I get only once my guid, but I see a request in Output/history for accessToken
- Request `No Update of AccessToken after First Request` does only `@ref` accessToken => only on first request the complete request chain is used and after that all calls a prevented.
![forceref](https://user-images.githubusercontent.com/13434739/188223579-9798017e-1534-415e-b3e7-e30857196d8b.gif)
The difference between `@ref` and `@forceRef` is only whether the variable `login` or `accessToken` are present. [If `@ref` and the variable is present](https://github.com/AnWeber/httpyac/blob/main/src/plugins/core/metaData/refMetaDataHandler.ts#L48), I would not re-execute the request. But this also only means that I consider this for the current `@ref` request so a behavior `@forceRefDeep` I have not considered.
Another workaround would be to run command `httpyac.reset` as this will clear all variables.
Hello Andreas,
I think so.
I have a cell "# @name login" that is used by an accessToken cell in the same httpbook, "# @name accessToken"; itself used by a cell in another httpbook. Whether the references are cascaded by @forceRef or by @ref - after the first two cells are executed, my token is still the one from before and becomes invalid over time. I have to close VSCode and reopen it so that the token being used is the correct one. I tried to clear the cache but it doesn't change anything.
Thank you again for this great work which helps me a lot.