summaryrefslogtreecommitdiffstats
path: root/dom/security/test/cors/bug1456721.sjs
blob: de8bd5a7f4f4be2dc7853cf09fc5d02db7e72d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function handleRequest(request, response) {
  response.setHeader("Cache-Control", "no-cache", false);
  let queryStr = request.queryString;

  if (queryStr === "redirect") {
    response.setStatusLine("1.1", 302, "Found");
    response.setHeader("Location", "bug1456721.sjs?load", false);
    response.setHeader("Access-Control-Allow-Origin", "*", false);
    return;
  }

  if (queryStr === "load") {
    response.setHeader("Content-Type", "text/html", false);
    response.setHeader("Access-Control-Allow-Origin", "*", false);
    response.write("foo");
    return;
  }
  // we should never get here - return something unexpected
  response.write("d'oh");
}