mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
30 lines
836 B
JavaScript
30 lines
836 B
JavaScript
function handleRequest(request, response) {
|
|
|
|
var query = {};
|
|
|
|
request.queryString.split('&').forEach(function(val) {
|
|
var [name, value] = val.split('=');
|
|
query[name] = unescape(value);
|
|
});
|
|
response.setHeader("Cache-Control", "no-cache", false);
|
|
|
|
if ("type" in query) {
|
|
switch (query.type) {
|
|
case "script":
|
|
response.setHeader("Content-Type", "application/javascript");
|
|
response.write("\n\ndocument.write('<pre>script loaded\\n</pre>');\n\n");
|
|
return;
|
|
case "style":
|
|
response.setHeader("Content-Type", "text/css");
|
|
response.write("\n\n.cspfoo { color:red; }\n\n");
|
|
return;
|
|
case "img":
|
|
response.setHeader("Content-Type", "image/png");
|
|
return;
|
|
}
|
|
}
|
|
|
|
response.setHeader("Content-Type", "text/plain");
|
|
response.write("ohnoes!");
|
|
}
|