You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to only set a var if an expression returns something other than undefined?
For example, I have a collection-level post-request var expression to pull a value off of the body, say res.body.token -> varToken. This res.body.token value exists for only some of the responses in the collection. Is there a way to keep varToken from being overwritten when res.body.token doesn't exist, using an expression in the Vars tab?
Not a huge deal, I know I can just use a collecton level script instead. But curious if there's a shorthand expression I could have used with the Vars tab instead.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to only set a var if an expression returns something other than
undefined?For example, I have a collection-level post-request var expression to pull a value off of the body, say
res.body.token->varToken. Thisres.body.tokenvalue exists for only some of the responses in the collection. Is there a way to keepvarTokenfrom being overwritten whenres.body.tokendoesn't exist, using an expression in the Vars tab?Not a huge deal, I know I can just use a collecton level script instead. But curious if there's a shorthand expression I could have used with the Vars tab instead.
Beta Was this translation helpful? Give feedback.
All reactions