-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfake_rls_fail.js
executable file
·31 lines (24 loc) · 968 Bytes
/
fake_rls_fail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env node
//Simplified FAKE RLS server for testing failures
var http = require('http'),
fs = require('fs'),
qs = require('querystring'),
loader = fs.readFileSync('/Users/davglass/src/local/3.x/build/loader/loader-min.js', 'utf8');
http.createServer(function (req, res) {
var q = qs.parse(req.url.split('?')[1]);
var missing = [];
if (q && q.m && q.m.length) {
missing = q.m.split(',');
}
/*
This sends:
YUI.$rls({
error: "RLS Server Error",
modules: ["loader-base", "loader-rollup", "loader-yui3"],
missing: [] //The modules passed in via ?m=
});
*/
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(loader + '\n\nYUI.$rls({ error: "RLS Server Error", modules: [ "loader-base", "loader-rollup", "loader-yui3" ] , missing: ' + JSON.stringify(missing) + ' });');
}).listen(5000);
console.log('Fake Failure RLS server listening: http://localhost:5000/?');