blob: 09a5f17356e0c70f8ba27ab9c82c976f57c52c28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function handleRequest(request, response) {
var query = {};
request.queryString.split("&").forEach(function (val) {
var [name, value] = val.split("=");
query[name] = unescape(value);
});
if (request.method == "POST") {
setState(query.id, "ping");
} else {
var value = getState(query.id);
response.setHeader("Content-Type", "text/plain", false);
response.write(value);
}
}
|