usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
21.54k stars 1.01k forks source link

[Feature] Add command bru.rmVar(varType, key) and/or bru.rmEnvVar(key) #2464

Open bpoulaindev opened 1 week ago

bpoulaindev commented 1 week ago

I have checked the following:

Describe the feature you want to add

Add a command bru.rmVar(varType, key) that would allow users to unset a variable (equivalent of pm.environment.unset but more modular) Javascript behavior (can be done in scripts tab) : replace "toDelete" with the key to delete, and "envVariables" by another varType

bru = Object.entries(bru).reduce((acc, [key, value]) => {
  acc[key] = key === "envVariables" ?
    Object.fromEntries(Object.entries(value).filter(([k]) => k !== "toDelete")) :
    value;
  return acc;
}, {});

Mockups or Images of the feature

image