summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/identity/idp.sjs
blob: e1a245be780e5c7849e7222d9f37e5c745b69922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function handleRequest(request, response) {
  var key = "/.well-known/idp-proxy/" + request.queryString;
  dump(getState(key) + "\n");
  if (request.method === "GET") {
    if (getState(key)) {
      response.setStatusLine(request.httpVersion, 200, "OK");
    } else {
      response.setStatusLine(request.httpVersion, 404, "Not Found");
    }
  } else if (request.method === "PUT") {
    setState(key, "OK");
    response.setStatusLine(request.httpVersion, 200, "OK");
  } else {
    response.setStatusLine(request.httpVersion, 406, "Method Not Allowed");
  }
  response.setHeader("Content-Type", "text/plain;charset=UTF-8");
  response.write("OK");
}