function readHttpJson(location) { return Q.when(HTTP.read(location), function (content) { try { return JSON.parse(content); } catch (exception) { return Q.reject(exception); } }); }
return Q.when(ready, function () { return HTTP.read({ "url": "http://localhost:8080/", "method": test.method }) .then(function (content) { assert.equal(content, test.content, test.method + " content"); }, function (response) { assert.equal(response.status, 200, test.method + " status"); return Q.when(response.body, function (body) { return body.read().then(function (content) { console.log(content.toString("utf-8")); }); }); }) });
loader.fetch = function (id) { var url = basePath + '/' + id + '.js'; return HTTP.read(url); };