Source code
Revision control
Copy as Markdown
Other Tools
/* Any copyright is dedicated to the Public Domain.
*/
function handleRequest(request, response) {
let params = new URLSearchParams(request.queryString);
let test = params.get("set_test");
if (test === null) {
test = getState("test");
} else {
setState("test", test);
response.setHeader("Access-Control-Allow-Origin", "*");
response.setStatusLine(request.httpVersion, 200, "OK");
return;
}
if (request.hasHeader("Cookie")) {
response.setStatusLine(request.httpVersion, 400, "Bad Request");
return;
}
if (request.hasHeader("Origin") && request.getHeader("Origin") != "null") {
response.setStatusLine(request.httpVersion, 400, "Bad Request");
return;
}
if (request.hasHeader("Referer")) {
response.setStatusLine(request.httpVersion, 400, "Bad Request");
return;
}
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Content-Type", "application/json");
let content = {
accounts_endpoint:
client_metadata_endpoint:
id_assertion_endpoint:
};
let bodyFormat = JSON.stringify(content);
let body = bodyFormat.replaceAll("TESTNAME", test);
response.setStatusLine(request.httpVersion, 200, "OK");
response.write(body);
}