Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
667 B
57
Indexable
Never
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;
}
Leave a Comment