2010-01-22 13:38:21 -08:00
|
|
|
// SJS file for CSP mochitests
|
|
|
|
|
|
|
|
function handleRequest(request, response)
|
|
|
|
{
|
|
|
|
var query = {};
|
|
|
|
request.queryString.split('&').forEach(function (val) {
|
|
|
|
var [name, value] = val.split('=');
|
|
|
|
query[name] = unescape(value);
|
|
|
|
});
|
|
|
|
|
|
|
|
var isPreflight = request.method == "OPTIONS";
|
|
|
|
|
|
|
|
|
|
|
|
//avoid confusing cache behaviors
|
|
|
|
response.setHeader("Cache-Control", "no-cache", false);
|
|
|
|
|
2010-03-12 13:53:37 -08:00
|
|
|
if ("type" in query) {
|
|
|
|
response.setHeader("Content-Type", unescape(query['type']), false);
|
2010-01-22 13:38:21 -08:00
|
|
|
} else {
|
2010-03-12 13:53:37 -08:00
|
|
|
response.setHeader("Content-Type", "text/html", false);
|
|
|
|
}
|
2010-01-22 13:38:21 -08:00
|
|
|
|
2010-03-12 13:53:37 -08:00
|
|
|
if ("content" in query) {
|
|
|
|
response.setHeader("Content-Type", "text/html", false);
|
|
|
|
response.write(unescape(query['content']));
|
2010-01-22 13:38:21 -08:00
|
|
|
}
|
|
|
|
}
|