Untitled

 avatar
unknown
plain_text
a year ago
667 B
65
Indexable
async function onResponse(context, url, request, response) {
  // console.log(response);

  // Update or Add new headers
  // response.headers["Content-Type"] = "application/json";

  // Update status Code
  // response.statusCode = 500;

  // Update Body
  // Update Body
  var body = response.body;
  
  let featureGates = body["feature_gates"];
  
  for (const key in featureGates) {
    if (featureGates[key].value === false) {
      featureGates[key].value = true;
    }
  }

  body["feature_gates"] = featureGates;
  
  response.body = body;
  // Or map a local file as a body
  // response.bodyFilePath = "~/Desktop/myfile.json"

  // Done
  return response;
}
Editor is loading...
Leave a Comment