summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_CSP.sjs
blob: ff41690078f057ec93b448b6e620522f402bdb83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// SJS file for CSP mochitests

function handleRequest(request, response) {
  var query = {};
  request.queryString.split("&").forEach(function (val) {
    var [name, value] = val.split("=");
    query[name] = unescape(value);
  });

  var isPreflight = request.method == "OPTIONS";

  //avoid confusing cache behaviors
  response.setHeader("Cache-Control", "no-cache", false);

  if ("type" in query) {
    response.setHeader("Content-Type", unescape(query.type), false);
  } else {
    response.setHeader("Content-Type", "text/html", false);
  }

  if ("content" in query) {
    response.write(unescape(query.content));
  }
}