flawiddsouza / Restfox

Offline-First Minimalistic HTTP & Socket Testing Client for the Web & Desktop

Home Page:https://restfox.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetEnvironmentVariablw Not Working

Mik39907 opened this issue · comments

commented

followed issue 76 video and I can get console.log(responseData.theaccesstoken)
shows correct token

but I can't set it to environment
context.response.setEnvironmentVariable('MyAccessToken', responseData.theaccesstoken)

no errors thrown and if I wrap that set with console.log shows as undefined

I have tried with new and already existing Variable Names neither work

Version 0.3.2 (ad16d94)

Hi @Mik39907, can you paste your full plugin script here?

commented

function handleResponse() {
const response = context.response.getBodyText()
const responseData = JSON.parse(response)
// console.log(responseData.Token)
context.response.setEnvironmentVariable('MyToken', responseData.Token)
}

and the rest is the default

That seems perfectly fine. Is there any possibility you can paste your environment here? With the sensitive info redacted. Let me check and see if I can reproduce the issue with the same script and environment.

By the way, in which environment are you checking if the value is set? The value will be set in the workspace environment, which is the option available at the top of the nav bar. It won't be set on the environment option that's available when you right click on a request folder.

commented

ok that's the issue I was checking at the folders
nevermind thx