Skip to content

Instantly share code, notes, and snippets.

@chankanzu
Created October 20, 2019 15:29
Show Gist options
  • Select an option

  • Save chankanzu/1643fd9ee2f64ec9aa6c3b72aa1d97f5 to your computer and use it in GitHub Desktop.

Select an option

Save chankanzu/1643fd9ee2f64ec9aa6c3b72aa1d97f5 to your computer and use it in GitHub Desktop.
let obj=JSON.parse($response.body)
let url = $request.url;
var cons1 = "me";
var cons2 = "dashboard";
var cons3 = "leaderboard";
if(url.indexOf(cons1) != -1)
{
obj["profile"]["is_pro"]=true;
body= JSON.stringify(obj);
}
if(url.indexOf(cons2) != -1)
{
obj["user"].is_premium= true;
body= JSON.stringify(obj);
}
if(url.indexOf(cons3) != -1)
{
obj["users"][0].is_premium= true;
body= JSON.stringify(obj);
}
$done({body});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment